You are here: Re: Is this possible easily? « All PHP « IT news, forums, messages
Re: Is this possible easily?

Posted by KiwiBrian on 05/26/05 09:23

Thanks very much Chris.
Very much appreciated.
I will try to implement what you have described.
Brian.

"Chris Hope" <blackhole@electrictoolbox.com> wrote in message
news:d72peg$3n1$1@lust.ihug.co.nz...
> KiwiBrian wrote:
>
>> I would like to create once a week, 7 pages, one for each day of the
>> following week, with just the page of the day accessible from a common
>> link. For example "Click here for the program of the day".
>> Can this functionality be implemented so that the link gets changed
>> automatically for each day, thus meaning that I can set it up for the
>> week and forget it until next week?
>
> Yes.
>
>> I am not a programmer, but am reasonably familiar with HTML and CSS.
>> I have been advised that this would be relatively trivial to implement
>> in PHP, which my server supports.
>> If so, where would I look on the web for such a script and how to
>> implement it?
>
> The date() function can be used to determine what the current day is and
> then it would be a simple matter of doing an if-then or switch
> statement to create the link.
>
> An easier way of doing it would be to just name the page names after the
> day of the week and then your link would look something like this:
>
> <a href="<?php echo date('l') ?>.php">blah blah blah</a>
>
> If today is Monday the link above would look like this in the outputted
> html:
>
> <a href="Monday.php">blah blah blah</a>
>
> If you wanted to make it all lower case (ie "monday" instead of
> "Monday") then do this:
>
> <a href="<?php echo strtolower(date('l')) ?>.php">blah blah blah</a>
>
> To implement an if-then statement instead you'd be looking at something
> like this:
>
> <?php
>
> function get_link() {
>
> $day = date('l');
> if($day == 'Monday') {
> $link = 'foo.php';
> }
> elseif($day == 'Tuesday') {
> $link = 'bar.php';
> }
> ...
>
> }
>
> ?>
>
> <a href="<?php echo get_link() ?>">blah blah blah</a>
>
> --
> Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация