Talon21 Posted July 6, 2008 Share Posted July 6, 2008 Hi all, I'm in the middle of building a new web site, and since I'm into SEO I would to use meta tags (title,keywords,desciption, etc...) The idea is like that, to use two different files for one page, for example: for the page about-us.php I will create one file called "about-us.php" under the folder /htdocs/ this file will held the meta tags as variables and of curse I will include the appropriate template. on the on the other file under the folder "content" I will create another "about-us.php" that will held the content. What will the two files should look like? thanks for your help. Link to comment https://forums.phpfreaks.com/topic/113459-meta-tags-as-variabls/ Share on other sites More sharing options...
PseudoEvolution Posted July 6, 2008 Share Posted July 6, 2008 I think you're looking for includes. So your content file would be the main page that people go to: <html> <head> <?php include(/path/to/file/about_us.php); ?> </head> <body> ...content... </body> </html> The include calls the path to the file holding your meta tags. In the meta tag version: <?php echo '<meta etc... /> <meta etc... />'; ?> Hope that helps! Link to comment https://forums.phpfreaks.com/topic/113459-meta-tags-as-variabls/#findComment-582981 Share on other sites More sharing options...
Talon21 Posted July 6, 2008 Author Share Posted July 6, 2008 Hi, thank you for your reply, I tried this but It won't work because I'm planing to use two template: main.php - for the index page only sub.php - for the internal pages Link to comment https://forums.phpfreaks.com/topic/113459-meta-tags-as-variabls/#findComment-582983 Share on other sites More sharing options...
PseudoEvolution Posted July 6, 2008 Share Posted July 6, 2008 You can use includes to include content as well... For example in your sub.php, between the body tags, you can include content as well: <body> <?php include('/path/to/file/about_us.php'); ?> </body> Then the about_us.php file could hold only the content. Are you using a single sub.php page for all of your non-index pages? If that's the case, you could use GET variables to choose which content will show. Example: mysite.com/sub.php?page=aboutus <body> <?php if ($_GET['page'] == 'aboutus') { include('about_us.php'); } elseif ($_GET['page'] == 'contact') { include('contact_us.php'); } ?> </body> Hope that clears it up... Link to comment https://forums.phpfreaks.com/topic/113459-meta-tags-as-variabls/#findComment-583000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.