Jump to content


Photo

Is this possible?


  • Please log in to reply
4 replies to this topic

#1 sdscuba

sdscuba
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 September 2006 - 07:34 AM

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.

#2 vbnullchar

vbnullchar
  • Members
  • PipPipPip
  • Advanced Member
  • 428 posts
  • LocationPasig City, Philippines

Posted 30 September 2006 - 10:43 AM

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
Registered Linux User #399942
Ubuntu User #14134
--
my blog

#3 FrOzeN

FrOzeN
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 30 September 2006 - 01:28 PM

Preferably, I'd do something like this:

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

function addBody() {
?>
<body>
<!-- etc.. -->
<?php
}
?>

Eg, index.php:
<?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>";
?>


#4 sdscuba

sdscuba
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 September 2006 - 02:53 PM

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


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.

#5 sdscuba

sdscuba
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 September 2006 - 03:00 PM

Preferably, I'd do something like this:

common_html.php:

<?php
function addHeader($title) {
?>
<html>
<head>
  <title><?php echo $title; ?></title>
  <!-- etc.. -->
<?php
}

function addBody() {
?>
<body>
<!-- etc.. -->
<?php
}
?>

Eg, index.php:
<?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>";
?>



Understood. I think this is the approach I am looking for. Thanks!  :-)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users