nick Posted June 9, 2011 Share Posted June 9, 2011 I notice in your code that when using a template format you have the header and footer code and You include the title with a variable. Is there a way to do that with the meta tags as well. Thanks Link to comment Share on other sites More sharing options...
Jonathon Posted June 9, 2011 Share Posted June 9, 2011 Define the meta tags information in a variable? Depending on the meta tag and the page it's going on you will probably need some way calling the correct meta information. I store mine in a table using a series of Primary and foreign keys to retrieve them. 1 Link to comment Share on other sites More sharing options...
nick Posted June 9, 2011 Author Share Posted June 9, 2011 well in most of the examples in the book. for the $page_title var it will be like $page_title = "About Us" or something of that nature. I was just curious is there was a similar way to do meta info becasue I wast planning on doing something like the following <?php //can something like this be done $meta_info ="Something Something"; $page_title = 'PDFS'; include('./includes/header.html'); some info include('./includes/header.html'); ?> Link to comment Share on other sites More sharing options...
Paul Swanson Posted June 9, 2011 Share Posted June 9, 2011 Sure, you can do that. You'll just need to have some PHP in your header.html that echoes that if it exists: <html> <head> <title><?php if (isset ($page_title) { echo $page_title; } ?></title> <?php if (isset ($meta_info) { echo $meta_info; } ?> </head> 1 Link to comment Share on other sites More sharing options...
HartleySan Posted June 10, 2011 Share Posted June 10, 2011 You can also use DHTML to add meta tags on the fly. In other words, you can use JavaScript to dynamically add meta tags to the page. That, however, is a client-side solution, and is removed from PHP. The choice is yours. Link to comment Share on other sites More sharing options...
Recommended Posts