manojkumar7 Posted July 31, 2013 Share Posted July 31, 2013 Hi all I am newbie to webdesign. I do wanna know what are the possible ways to write a title tag coding for a website (Dynamic and static)? Especially for Dyanmic sites! I hope I will find the answer here! Thanks in advance.... Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/ Share on other sites More sharing options...
cyberRobot Posted July 31, 2013 Share Posted July 31, 2013 It sure can. Note that the PHP code which generates the page title needs to appear before the <title> tag. Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1442802 Share on other sites More sharing options...
Psycho Posted July 31, 2013 Share Posted July 31, 2013 <?php //Insert code here to dynamically set the page title $pageTitle = "Today is " . date('m-d-Y'); ?> <html> <head> <title><?php echo $pageTitle; ?></title> </head> <body> Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1442808 Share on other sites More sharing options...
manojkumar7 Posted August 1, 2013 Author Share Posted August 1, 2013 It sure can. Note that the PHP code which generates the page title needs to appear before the <title> tag. Thanks cyberRobot! <title> tag would be used at the top of the coding part only if the page is static, right? for a dynamic site how it would be used to make a title to a page? Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1442957 Share on other sites More sharing options...
manojkumar7 Posted August 1, 2013 Author Share Posted August 1, 2013 <?php //Insert code here to dynamically set the page title $pageTitle = "Today is " . date('m-d-Y'); ?> <html> <head> <title><?php echo $pageTitle; ?></title> </head> <body> Thanks for your reply Psycho! Again this would also for a static kind of a page, right? If not, Sorry for the statement predefined the title statement to show up today's date And will it shoe up for every page? How to make title tags unique for every page.... Please reply I would like to continue the conversation to learn the new thing... Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1442958 Share on other sites More sharing options...
cyberRobot Posted August 1, 2013 Share Posted August 1, 2013 Are all of your pages built from a single script? It might help if you provide more information on what you're looking to accomplish. It might also help if you have some sample code to show. Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1442972 Share on other sites More sharing options...
manojkumar7 Posted August 2, 2013 Author Share Posted August 2, 2013 Are all of your pages built from a single script? It might help if you provide more information on what you're looking to accomplish. It might also help if you have some sample code to show. I think its would be right! title tags are called from a single script. here is a sample code of an websites' header part: And, I think I got the correct header code!! <?php class ControllerCommonHeader extends Controller { protected function index() { $this->data['title'] = $this->document->getTitle(); if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) { $this->data['base'] = $this->config->get('config_ssl'); } else { $this->data['base'] = $this->config->get('config_url'); } $this->data['description'] = $this->document->getDescription(); $this->data['keywords'] = $this->document->getKeywords(); $this->data['links'] = $this->document->getLinks(); $this->data['styles'] = $this->document->getStyles(); $this->data['scripts'] = $this->document->getScripts(); $this->data['lang'] = $this->language->get('code'); $this->data['direction'] = $this->language->get('direction'); and it goes on..... this is the major part needed to work with the title section(i think so!) how does the above code works? How to make the code to have a unique manually editable Title tags for all the pages.. Not only for this particular code. I need to have a designing knowledge as well.... Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1443151 Share on other sites More sharing options...
cyberRobot Posted August 2, 2013 Share Posted August 2, 2013 Are you using OpenCart? If so, perhaps this will help: http://forum.opencart.com/viewtopic.php?t=45398 Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1443166 Share on other sites More sharing options...
manojkumar7 Posted August 5, 2013 Author Share Posted August 5, 2013 Are you using OpenCart? If so, perhaps this will help: http://forum.opencart.com/viewtopic.php?t=45398 Its a huge lesson to learn More! Will Have to make some time to implement!! Thanks for the link. Will come back soon for more things................. Quote Link to comment https://forums.phpfreaks.com/topic/280669-how-to-write-title-tags-for-a-website/#findComment-1443513 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.