WordPress.org

Ready to get started?Download WordPress

Forums

Using the "the_time" tag in PHP (2 posts)

  1. Candelaar
    Member
    Posted 8 years ago #

    This might be an already solved problem, but I couldn;t find it!

    I am trying to establish a variable called $imgpath so I can call photos in my post which are named in the same format as the 'the_time' tag.

    My problem occurs with using the 'the_time' tag in PHP.
    $y = <path>
    $x = the_time (Ymd)
    $z = <extension>
    $imgpath= $y $x $z

    When for example on 5th of October 2005 an echo/print statement of $imgpath it will show :

    20041005photos/.swf

    instead of the wanted output:

    photos/20041005.swf

    Does anybody have any idea how I could get to the correct output ??

    Thanks in advance
    ________________________________________________________

    <?php
    $filename1= "photos/";
    $filename2= the_time('Ymd');
    $filename3= ".swf";
    $imgpath= "$filename1$filename2$filename3";
    echo "$imgpath";
    ?>
    <br>
    <?php
    if (file_exists($imgpath))
    {
    echo "<object width='480' height='360'>";
    echo "<param name='movie' value='";
    echo "$imgpath'/>";
    echo "<param name='quality' value='high' />";
    echo "<param name='bgcolor' value='#ffffff' />";
    echo "<embed src='";
    echo "$imgpath'";
    echo "width='480' height='360' type='application/x-shockwave-flash' />";
    echo "</object>";
    }

    else
    {
    echo "<img src=photos/";
    echo the_time('Ymd');
    echo ".jpg";
    echo ">";
    }

    ?>

  2. Candelaar
    Member
    Posted 8 years ago #

    OOOOOPSSS

    got it!!

    The answer is :

    get_the_time() instead of using the_time

    Xorry to have spammed the support forum :(

Topic Closed

This topic has been closed to new replies.

About this Topic