Announcement

Collapse
No announcement yet.

how do i replace summin with a file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mark Hensler
    replied
    try something like this:
    PHP Code:
    $string "hehefhrhnewsiorfji";
    $news implode(''file("http://www.example.com/path/to/news.php"));
    $string str_replace("news"$news$string);
    echo 
    $string
    If news.php needs any variables from this script, you will need to send it in a querystring in the file() call.

    Leave a comment:


  • megahard
    replied
    i 4got to mention that news.php contains php code that needs to be executed, sorry

    its now printing the file contents instead of actually showing the html output of news.php, if ya get me

    Leave a comment:


  • megahard
    replied
    thanx man, this forum shud be called the "max albert forum"

    Leave a comment:


  • Mark Hensler
    replied
    file() returns an array, not a string.

    $news=implode('', file("news.php"));

    Leave a comment:


  • megahard
    started a topic how do i replace summin with a file?

    how do i replace summin with a file?

    i need to replace a word with the contents of a file but i dont know how

    i tried:


    PHP Code:
    $string="hehefhrhnewsiorfji";
    $news=file("news.php");
    $string=str_replace("news",$news,$string);
    echo 
    $string
    but had no luck


    TIA
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X