1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Tokens with php?

Discussion in 'Programming' started by aim_high, Aug 3, 2009.

  1. #1
    This is what I want to do.

    Have a web page with a paragraph. Lets say

    "Hi my name is Bill. blah blah"

    but I want to use tokens so its

    "Hi my name is {Name}"

    where name is like a list of 20 names. Is there a way to draw data from an excel spreadsheet opposed to just having it all in the coding which would get messy? Is there a better solution opposed to php?
     
    aim_high, Aug 3, 2009 IP
  2. quirksmode

    quirksmode Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The best solution depends. Do you think you will need to add more and more names to the list of names eventually? Or will there only be 20 static names.

    When you ask if there's a better solution than PHP, are you asking for alternatives to the PHP language, or alternative solutions to using a scripting language to pull from a database?
     
    quirksmode, Aug 3, 2009 IP
  3. ricky92

    ricky92 Active Member

    Messages:
    16
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #3
    I think what you're looking for is a template engine. You can google for some, one of the best is smarty.
     
    ricky92, Aug 3, 2009 IP