#1
  1. No Profile Picture
    d0g1e
    Guest
    Devshed Newbie (0 - 499 posts)
    My previous post didn't make much sense when i read it afterwards, so i rewrote it:

    What i need is a script that reads a file, searches for a & and takes the first word which comes after it and puts that word in a variable.
    Example:

    (This is part of the template)
    <img src="&ImageLogoLocation">

    After script is run a variable should contain
    the string: ImageLogoLocation

    Thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    456
    Rep Power
    15
    I can't really help you, but the "Perl Cookbook" from O'Reily is a great book with practical perl examples. If you want to make a great $40.00 investment I would suggest this book. It has information on template parsing.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    19
    Rep Power
    0
    I can suggest general aproach.
    1. You need define rule for parsing your template. And use appropriated mechanism to seaching positions for substitutions and making it (If you have decided to seach '&' as start position what will define the end of string for substitution, this is the full name of variable).
    2. Read template, look for strings for substitution, fill out requred position.
    (You can use Hash, database, etc for storing and getting desired value of desired variable)
    3. Print to stdout (in your case clients webpage) the strings with concatanating of initial static contents and filled by values variables.
    Hope it helps.
    One of other general aproachs is to invite somebody to write script.

  6. #4
  7. No Profile Picture
    d0g1e
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks for your ideas. I think i'll look into perl regular expression tutorials
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    11
    Rep Power
    0
    Try the HTML::Template module.


    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by d0g1e:
    Thanks for your ideas. I think i'll look into perl regular expression tutorials [/quote]

  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    I like the way everybody dodged the question there
    for <img src="&ImageLogoLocation">:

    if($string=~m/&(.*?)"/){$var=$1}
    print $var;

    Would print "ImageLogoLocation"

IMN logo majestic logo threadwatch logo seochat tools logo