Jump to content

Archived

This topic is now archived and is closed to further replies.

sdscuba

Is this possible?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Preferably, I'd do something like this:

[b]common_html.php[/b]:
[code]<?php
function addHeader($title) {
?>
<html>
<head>
  <title><?php echo $title; ?></title>
  <!-- etc.. -->
<?php
}

function addBody() {
?>
<body>
<!-- etc.. -->
<?php
}
?>[/code]

Eg, [b]index.php[/b]:
[code]<?php
include '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]

Share this post


Link to post
Share on other sites
[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.

Share this post


Link to post
Share on other sites
[quote author=FrOzeN link=topic=110050.msg444209#msg444209 date=1159622891]
Preferably, I'd do something like this:

[b]common_html.php[/b]:
[code]<?php
function addHeader($title) {
?>
<html>
<head>
  <title><?php echo $title; ?></title>
  <!-- etc.. -->
<?php
}

function addBody() {
?>
<body>
<!-- etc.. -->
<?php
}
?>[/code]

Eg, [b]index.php[/b]:
[code]<?php
include '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!  :-)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.