sdscuba Posted September 30, 2006 Share Posted September 30, 2006 Is it possible to contain all html code in a mysql database? Then use only php to build the web pages?I need to create 15 subdomains that have common html code. Only a few changes exists between the subdomains. I would like to make it easy in making changes to all common code between subdomains by having a common table in the database, then have a record for each subdomain that contains the differences.Is this something I can accomplish with php and mysql?Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/22570-is-this-possible/ Share on other sites More sharing options...
vbnullchar Posted September 30, 2006 Share Posted September 30, 2006 its possible, but why would u do that... I suggest that you go for a template page ex..<html><head><title>{title}</title></head></html>then just replace {title} with the title of the the current page Link to comment https://forums.phpfreaks.com/topic/22570-is-this-possible/#findComment-101324 Share on other sites More sharing options...
FrOzeN Posted September 30, 2006 Share Posted September 30, 2006 Preferably, I'd do something like this:[b]common_html.php[/b]:[code]<?phpfunction addHeader($title) {?><html><head> <title><?php echo $title; ?></title> <!-- etc.. --><?php}function addBody() {?><body><!-- etc.. --><?php}?>[/code]Eg, [b]index.php[/b]:[code]<?phpinclude 'common_html.php';addHeader("Home page");echo "Some other stuff to go on the header\n</head>";addBody();echo "Some stuff to go on the homepage!\n</body>\n</html>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/22570-is-this-possible/#findComment-101353 Share on other sites More sharing options...
sdscuba Posted September 30, 2006 Author Share Posted September 30, 2006 [quote author=vbnullchar link=topic=110050.msg444178#msg444178 date=1159613027]its possible, but why would u do that... I suggest that you go for a template page ex..<html><head><title>{title}</title></head></html>then just replace {title} with the title of the the current page[/quote]My idea was to have all common html code in a database so that when a change needs to be made, I change it once in the database so that all subdomain websites are updated at once. Using a template would mean me changing the common html in all subdomains. Link to comment https://forums.phpfreaks.com/topic/22570-is-this-possible/#findComment-101384 Share on other sites More sharing options...
sdscuba Posted September 30, 2006 Author Share Posted September 30, 2006 [quote author=FrOzeN link=topic=110050.msg444209#msg444209 date=1159622891]Preferably, I'd do something like this:[b]common_html.php[/b]:[code]<?phpfunction addHeader($title) {?><html><head> <title><?php echo $title; ?></title> <!-- etc.. --><?php}function addBody() {?><body><!-- etc.. --><?php}?>[/code]Eg, [b]index.php[/b]:[code]<?phpinclude 'common_html.php';addHeader("Home page");echo "Some other stuff to go on the header\n</head>";addBody();echo "Some stuff to go on the homepage!\n</body>\n</html>";?>[/code][/quote]Understood. I think this is the approach I am looking for. Thanks! :-) Link to comment https://forums.phpfreaks.com/topic/22570-is-this-possible/#findComment-101385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.