PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 16, 2022

[FIXED] pull data from page without database

 March 16, 2022     php     No comments   

Issue

I am making a php site without using a database. I add the header and footer to the page with the include function.

How can I dynamically create meta tags by pulling information from inside the page.

<?php include "inc/head.php" ?>


<main>

 <article>

   <h1>Page Name</h1>

    <div>Post Body</div>
 
 </article>

</main>

<?php include "inc/footer.php" ?>

Solution

The point is: first, define your php variables; then use them when needed. for example

in the "inc/head.php"file define the variables so you can access them later like

$page_name = 'The Page Name';

so now you can set your h1 context like

<h1><?php echo $page_name; ?></h1>


Answered By - Ersin
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing