Jump to content

Help


unidox

Recommended Posts

I have this code:

 

function get_tag_inside($content, $tag) {
$content = preg_replace("@\{" . $tag . "\}(.+)\{\/" . $tag . "\}@i", "$1", $content);
return $content;
}

function get_tag($tag, $replace, $tpl) {
$replace = preg_replace("@\{" . $tag . "\}@", $replace, $tpl);
return $replace;
}

$index = file_get_contents("pages/news.inc.php");
$site = get_tag("content", "body", $index);
$site = get_tag_inside($site, "title");
echo $site;

 

But the problem is, I dont want to replace the title, I just want to turn it into a variable and/or const. I am trying to get all the info inside the {title}{/title} tags.

Link to comment
Share on other sites

please don't make multiple threads asking the same thing. You already had a thread asking about this. You were redirected to the regex forum where you posted the same question.  Now this one, asking the same thing.  Asking the same thing over and over in multiple threads will not get your problem solved any faster.

 

thread closed.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.