Display title of page

Discussion in 'PHP' started by DeluxeEdition, Feb 20, 2007.

  1. #1
    Well my question isn't as simple as it sounds.

    I'm reworking a Flat File and embedding an RSS Feed. The title is already set by hand but the RSS Feed is going to be pulled dynamically based on the page title. I was trying this

    
    <?php
    $rss_keyword = '<script type="text/javascript"> document.write(document.title) </script> ';
    
    The Rest of the RSS Code
    ?>
    
    Code (markup):
    But that didn't work does anyone have any ideas
     
    DeluxeEdition, Feb 20, 2007 IP
  2. picouli

    picouli Peon

    Messages:
    760
    Likes Received:
    89
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sorry but I didn't understand your question - can you please explain it a bit better? (or maybe it's just me... ;))
     
    picouli, Feb 21, 2007 IP
  3. DeluxeEdition

    DeluxeEdition Active Member

    Messages:
    308
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    58
    #3
    I need to be able to get the title of the page so it can be used to grab an rss feed.
     
    DeluxeEdition, Feb 21, 2007 IP
  4. picouli

    picouli Peon

    Messages:
    760
    Likes Received:
    89
    Best Answers:
    0
    Trophy Points:
    0
    #4
    And you don't know the title *before* you grab the RSS feed? And how do you grab the feed? Why would you need JavaScript?

    The code you proposed doesn't work because PHP is *server side*, while JavaScript is *client side* - therefore you can't write in a PHP block with JavaScript since the PHP block doesn't "exist" anymore once the JavaScript gets executed.

    HTH, cheers
     
    picouli, Feb 21, 2007 IP