parikh13 Posted February 13, 2008 Share Posted February 13, 2008 Hi! I've one php file in which due to some reason there are hard coded meta tags are there: for instance the source code of file is <html> <head> <title>My Page Title</title> <meta name="title" content="My Page Title" /> <meta name="description" content="Simple Test can be useful"> </head> </html> Now I want to change the content of existing meta tag (Meta title) on runtime. But not getting solution how to do that Now i want to see the source code after running the file is: <html> <head> <title>NEW PAGE TITLE</title> <meta name="title" content="NEW PAGE TITLE" /> <meta name="description" content="Simple Test can be useful"> </head> </html> N.B. I have tried ereg_replace, strip_tags etc but it simply adds or duplicates to source file kindly help me how can i do that? Link to comment https://forums.phpfreaks.com/topic/90887-how-to-editchange-existing-static-html-meta-tag/ Share on other sites More sharing options...
pdkv2 Posted February 13, 2008 Share Posted February 13, 2008 make this page to .php file and do the following <html> <head> <title>NEW PAGE TITLE</title> <meta name="title" content="<?php echo $meta_info; ?>" /> <meta name="description" content="Simple Test can be useful"> </head> </html> Link to comment https://forums.phpfreaks.com/topic/90887-how-to-editchange-existing-static-html-meta-tag/#findComment-465781 Share on other sites More sharing options...
thebadbad Posted February 13, 2008 Share Posted February 13, 2008 If it's hardcoded you just have to locate where in the script it's done, and edit it. If you haven't got the file for some reason, I'm sure you could do it with javascript, but that seems like extra work. Link to comment https://forums.phpfreaks.com/topic/90887-how-to-editchange-existing-static-html-meta-tag/#findComment-465892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.