• dml3001

    (@dml3001)


    I would like to call on a variable outside of the php function.

    I want to use my url: www.mysite.com/ and add the current date to the end of it.

    I need to call on a php function to do this, therefore, I was going to do this:

    $date=<?php the_date(‘Y/m/d’); ?>

    Then, I want to combine my url with the date as follows:

    <a href="www.mysite.com/$date">MY TITLE</a>

    How do I go about doing this? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dml3001

    (@dml3001)

    P.S. What I tried, doesn’t work…

    mshane8

    (@mshane8)

    everything has to go inside the php tags. even if the variable is created outside the function itself it cant be outside the php tags.

    Thread Starter dml3001

    (@dml3001)

    How would I make an a href with the date at the end of the link then?

    <?php
    
    $url = "http://www.hiphoplot.com/";
    $date = the_date('Y/m/d/');
    echo $url . $date;
    <a href="echo $url . $date";>
    ?>
    
    	<div align="center"><font color=\"#FF00FF\"><?php the_date('l - F jS', '<h2>', '</h2>'); ?></font></div>
    </a>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Call on a variable outside of the php function’ is closed to new replies.