Jump to content

String to remove html


smartguyin

Recommended Posts

Yes i have seen this before also.... but still i can't find what i want ?

See the [main] which is used 2 times in header.tpl And i want to use it as full code time in my body tag and only text in tilte tag here --- <title>[main]</title> when i doo this i get full html coding here please help to get only text in title....

The variable "main" is coming from index.php

please i'll be very thank full if you help me....
i think he may be asking how to parse out the "[main]" and replace it with a $main variable???

try something like this:
[code]
$string = "<title>[main]</title>\n";
$main = "My Title";
$string = preg_replace('|\[main\]|i', $main, $string);
echo $string;
[/code]
[!--quoteo(post=349097:date=Feb 25 2006, 12:05 AM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Feb 25 2006, 12:05 AM) [snapback]349097[/snapback][/div][div class=\'quotemain\'][!--quotec--]
i think he may be asking how to parse out the "[main]" and replace it with a $main variable???

try something like this:
[code]
$string = "<title>[main]</title>\n";
$main = "My Title";
$string = preg_replace('|\[main\]|i', $main, $string);
echo $string;
[/code]
[/quote]

Now as you said I placed this code in header.tpl but it's not working. It's .tpl file soo can i put php script in that file.

[main] has html code --- the code changes as click on different categoris or product.

<p class="main"><a href='/index.php'>Top</a>: <a href='/index.php/category/'>Category</a>: <a href='/index.php/category/product/'>Product</a>: </p>

Out of These i want text from the html code like "Top : Category : Product" soo that it can be displayed in Title. And Also in Body Part i want to used Full html code... and its there every thing fine with that.... Only need to Fix this Title Tag.

This [main] html code comes from index.php and now in header.tpl and want to use [main] 2 times one with the Full html code and one with only Text...



Please Help Me Its been soo many days i am solve this querry but ....

Please Guys Help Me
Hello,

As far as i understand u r trying to use the same variable [main] in title as well as body, but in title u want to show text without HTML. I would advice u to use two diffenet variables

In TPL,
<title>[maintitle]</title>
.
.
.
<body>[main]</body>

In PHP,

$maintitle = strip_tags($title);

assign both title and maintitle in template

hth
[!--quoteo(post=349261:date=Feb 25 2006, 02:47 PM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Feb 25 2006, 02:47 PM) [snapback]349261[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hello,

As far as i understand u r trying to use the same variable [main] in title as well as body, but in title u want to show text without HTML. I would advice u to use two diffenet variables

In TPL,
<title>[maintitle]</title>
.
.
.
<body>[main]</body>

In PHP,

$maintitle = strip_tags($title);

assign both title and maintitle in template

hth
[/quote]


THANK YOU "SAMSHEL"

It Worked... I am a PHP Learner i also tried this step but made a little mistake some where but after your suggestion i tried it again and it worked....

Atlast my Querry was solved completely Thank's

Thank's Phpfreaks.com thanks samshel and other guys !

Archived

This topic is now archived and is 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.