/    Sign up×
Community /Pin to ProfileBookmark

Change & increment a filename weekly

I have some filenames that I want to have changed weekly ( every Wednesday Night at midnight)

This is my current filename

[url]http://www.some.org/723/max.html[/url]

How do I get php to change a variable by incrementing it on that weekly basis, so that I can do something like this. Psuedo Code:

[code=php]

link=http://www.some.org/724/max.html
var page=http://www.some.org/
issue = 723
newissue=issue++1/
var2=var page+(newissue)
var3=var2+max.html
varlink=var3
link=””
link=varlink

[/code]

I want to end up with this [url]http://www.some.org/724/max.html[/url] at the end of the 1st week’s change.

Any help or better ideas and code welcome.

Thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@hastxMay 31.2009 — There are 2 easy ways I can think of off the top of my head:
[LIST=1]
  • [*]Just make a text file containing the current number and increment it every week.

  • [*]Explode the url or get the containing directory ... get the integer value of the directory and increment it

  • [/LIST]


    Text file code:
    [code=php]
    $domain = "http://www.some.org/";
    $dir = file_get_contents('ref_num.txt');
    $next = intval($dir) + 1;
    $link = $domain . $dir . "/max.html";
    file_put_contents ('ref_num.txt',$next);
    [/code]


    To extract the containing dir and increment it:
    [code=php]
    $dir = basename(dirname('http://www.some.com/724/max.html'));
    $next = intval($dir)+1;
    [/code]
    Copy linkTweet thisAlerts:
    @simoraauthorJun 01.2009 — Thanks.

    This gets me started .

    I'm going to need some more details on getting the original setup .
    ×

    Success!

    Help @simora spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...