SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Exeter, Devon, UK
    0 Post(s)
    0 Thread(s)

    Executing function from within a string?

    Hi guys, long time, no post! [img]images/smilies/smile.gif[/img]

    I have a database table that will contain article text for echoing to the screen as part of an HTML document. Inside this text, there may (or may not, depending on the article) be a dynamically generated image table. It has to be generated on the fly.

    I have a function to query the DB and output the image table, but how can I run it from within the string?

    Take this example:-
    "Article text is here and then continues to here.</p>IMAGES HERE<p>Article continues..."

    I tried:-
    echo "Article text is here and then continues to here.</p><? showimages(232); ?><p>Article continues...";

    ..but of course, this does nothing aside from print the text.

    Is there any way of doing this. I want the writers to be able to just put <? showimage(251); ?> anywhere in the body of their text (wherever they want the images to show), without having to input any more code. Also, an article may not have any images so that would need to be taken into account.

    Any ideas? I'm stumped! [img]images/smilies/smile.gif[/img]

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Iowa, USA
    0 Post(s)
    0 Thread(s) but beware the security issues
    Jason Sweat ZCE -
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts