Sound Posted September 1, 2008 Share Posted September 1, 2008 I run a website were you could read a lot of reviews. Every review is included into the index.php via; <? } elseif ($_GET['page'] == "stormwarriorheadingnorthereview") { ?> <? include("writings/stormwarrior_heading_northe_review.txt") ?> I simply want the "Stormwarrior" review (and all the other reviews) to get a different title than the rest of the site. What should I do? Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/ Share on other sites More sharing options...
Fadion Posted September 1, 2008 Share Posted September 1, 2008 By title, you mean the html title tag? If so you can simply: <?php <head> <title><?php echo $_GET['somereviewpage']; ?></title> </head> ?> That isn't quite useful though as you just get some ugly titles. The best way to do this is to store your reviews in a database and have a title field. You can add all those text files of yours in the db quite easily (be it manually or automatically). The db table can be something like this: review_id | content | title | author | date Hope it helps. Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/#findComment-631126 Share on other sites More sharing options...
Sound Posted September 1, 2008 Author Share Posted September 1, 2008 I may be a newbie at this, but how should I apply it? When I added it, my site just went white.. Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/#findComment-631137 Share on other sites More sharing options...
Fadion Posted September 1, 2008 Share Posted September 1, 2008 Your site went white? Strange. You can just add that code in the title tag: <title> <?php if(isset($_GET['page'])){ echo $_GET['page']; } else{ echo 'This is home'; } ?> </title> Something like that. The title tag should be inside the < head > tag. As i said, the best approach to this should be using a MySQL database. Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/#findComment-631160 Share on other sites More sharing options...
Sound Posted September 1, 2008 Author Share Posted September 1, 2008 I see. In "This is home" i just write whatever I wan't to use on the rest of the side? But where to write the title I want on the review? Yeah, I'm gonna do a MySql database sometime, right now I have no clue how to do that Thanks Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/#findComment-631214 Share on other sites More sharing options...
Sound Posted September 1, 2008 Author Share Posted September 1, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/#findComment-631490 Share on other sites More sharing options...
Fadion Posted September 1, 2008 Share Posted September 1, 2008 Ok we are going on a dead-end. I'm not asking you to be a php expert, but at least try asking the right question. What do you mean by title, i asked it since the first post. Is it: Very nice movie Im writing a review about a movie and my review title is "Very nice movie". Read my review as it is very long...or isn't it. Ok i'm done. If you mean a < title > tag, which is the title that shows in the browser's top left corner, then use the code i suggested. The "echo 'This is home'" part will display the title in every page where the 'page' url variable (the review name) is not set. What do you want to know more? Link to comment https://forums.phpfreaks.com/topic/122234-different-titles-in-included-php/#findComment-631494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.