0

im curious if somene can help me out. i have a site that has content that changes once a year (dates when our hotel opens and when we close) i have the dates/times of various pages, and every year i forget to edit at least one of the pages (leaving last years info by mistake)
is it possible to have a page that houses all the dates/times/whatever else changes... and have the html page read from that?

for instance, index.html, season.html, and other pages have our dates of when we open and close...
i would like to create a file, dates.dat and have it inject the time i have and dates i have in that file, to those html pages...

ideally, in dates.dat file, i could have it as so

date_open=may 14, 2010
date_close=October 24, 2010
frontdesk_hours=7am until 10pm

etc....
then, in my webpage, i could have:
Welcome to so and so, our front desk hours are from <frontdesk_hours>
and we are open from <date_open> until <date_close>

can someone give me a hand, im sure this is a fairy easy feat..
thanks
pj

3
Contributors
9
Replies
10
Views
8 Years
Discussion Span
Last Post by pjrey
0

You can use SSI (shtml) - but not used much anymore.
Your best bet would be something like php (or asp) or any other server-side scripting.
However you can use just javascript, if your website doesn't allow server-side scripting.

What can you use? Or what are you allowed to use?

Edited by diafol: n/a

0

i have SSI, or php... i want to use whatever works best for this sort of application... i want to just edit one file, and have all dates with certain tags updated automatically...
thanks for your response
pj

0

the filenames of files that are to be server-acted upon have to be altered
ssi have to be .shtml
php have to be .php
so the href of links to those pages have to be altered
but you only have to do it once
the bonus is the same code can include your menu headers footers on each page so you only have to edit anything once, to change every page

<!--old page -->
<DTD>
<html>
<title>
<script>
bla bla
</script>
<style>
bla bla
</style>
<meta tag>
<meta tag>
<meta tag>
<meta tag>
<meta tag>
</head>
<body>
menu
bla bla bla

content
calendar
bla bla bla

foooter,
contactus
bla bla bla
</body>
</html>

that must be individually edited for every page,, becomes

<?php include('head.php'); ?>
<title>
<?php include('menu.php'); ?>
content
<?php include('calendar.php'); ?>
bla bla bla
<?php include('footer.php'); ?>

so if your address changes when you move warehouses, you just edit 1 footer.php file, not 900 pageshaving a good day

0

thanks for posting back with the helpful info.. all pages are currently .shtml (if i did the php includes tag, would the files then have to be php... or can a shtml use a php include tag? im all the road right now, will try all this out when i get home~!
thanks again
pj

0

.shtml includes, similar & different

<!--#include file="calendar.html" -->

and it can do all the duplicate stuff the same way as php,
with the header menu footer any content that is duplicated
includes is always the first transition from
'my first website ' to 'my second website'
php is more developed, there are more scripts for it and it can do more, then ssi, but its another learning curve, thats no good if you don't need the site to do more

Edited by almostbob: n/a

0

thanks again for all the helpful posts. i am looking for a way to do what i have talked about, but have it (all the variable data) in one file...
things_that_change.dat (or php)
and within that file, have it all right there...
eg..

hours_frontdesk=7 am unil 10pm
date_we_open=may 9th, 2010
cancelation_policy=blab lalakdf kdljfsdf lkdsf jk lkjs df
etc=etc

get me
so i wouldnt have to edit calendar.html, opendate.html, frontdeskhours.html, cancelationpolicy.html

instead, just one file, with all the info inside
and then the pages would call that page, (things_that_change.dat (shtml) and it would pull the tag from it
does that make sense?

and just use <frontdesk_hours>
and <cancelation_policy>

in any of the .shtml pages i had for my site, and it could insert the correct info via the things_that_change.dat file... (and tag)

thanks a bunch
pj

0

inside that one file, an array
$changes = array(
item => html content for that item
thingsthatchange.php

<?php $thingsthatchange= array(
'dates' => '1 may 2010 to 1 October 2010<br> season may be extended if the weather is really good in October',
'address' => '21 jump street',
'telephone' => '123 456 7890',
'somethingelse' => 'any html at all as long as quotes are escaped to not cause errors',
'menu' => '<ul class="menu"><li>item</li><li><ul class="submenu"><li>item</li><li>item</li><li>item</li></ul></li><li>item</li><li>item</li><li>item</li></ul>'
); ?>

and in the top of any page where any of this may be required

<dtd>
<?php include('thingsthatchange.php'); ?>
<html>
<head>
<?php echo $thingsthatchange['headers']; ?>
</head><body>
<?php echo $thingsthatchange['menu'];?>
content bla bla bla bla
<?php echo $thingsthatchange['contactus'].$thingsthatchange['footer'];?>
</html>

just one possibility,
I prefer separate head/menu/footer/date/contactus inserts because they change with different frequencies, but like everything its pers. preference
I have a folder /includes for them
head.php
menu.php
contactus.php
hoursop.php
locations.php
footer.php
the contactus page just lookslike

<?php include('/includes/head.php');
echo '<title>Contact Us</title>';
include('/includes/menu.php');
 include('/includes/contactus.php');
 include('/includes/locations.php');
 include('/includes/hoursop.php');
 include('/includes/footer.php');
?>

Edited by almostbob: n/a

0

almostbob, thank you, this is exactly what i am looking for.. one thing, it seems not to be working for me...
i have php on my site

i tried creating a file, thingsthatchange.php and inserting the top code you gave me:

<?php $thingsthatchange= array(
'dates' => '1 may 2010 to 1 October 2010<br> season may be extended if the weather is really good in October',
'address' => '21 jump street',
'telephone' => '123 456 7890',
'somethingelse' => 'any html at all as long as quotes are escaped to not cause errors',
'menu' => '<ul class="menu"><li>item</li><li><ul class="submenu"><li>item</li><li>item</li><li>item</li></ul></li><li>item</li><li>item</li><li>item</li></ul>'
); ?>

and saved it.
now i created a new file, called it TEST.php and inserted the second bit of code:

<dtd>
<?php include('thingsthatchange.php'); ?>
<html>
<head>
<?php echo $thingsthatchange['headers']; ?>
</head><body>
<?php echo $thingsthatchange['menu'];?>
content bla bla bla bla
<?php echo $thingsthatchange['contactus'].$thingsthatchange['footer'];?>
</html>

and i changed the footer, contact us etc.. to things in the thingsthatchange.php file (telephone, dates etc...)

but they wouldnt show up on TEST.php

i have the code:

#
<dtd>
#
<?php include('thingsthatchange.php'); ?>
#
<html>

at the VERY top of my page (TEST.shtml, and now TEST.php)

something else im missing?

again, thank you so much, this is EXACTLY what i am looking for!
thank you for your time
pj

ps. is there any way to do the same thing (in terms of one file holding all data) for SHTML?
im just worried i would run into lots of snags if i start renaming all files to php...
i know NOTHING of php... maybe its time i start huh...

Edited by pjrey: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.