Forum
perch_template - stripping html tags
I am using a list/detail page on a website, so the 'detail' is provided by perch_content_custom. As I don't want to echo the result straight away (I want to store it in a variable), I am using the "skip-template" option.
I then pass the variable to perch_template, to run against a template (again, I don't want this to echo immediately, so it's passed to a variable).
One of the fields contains text styled by textile, so when the data is passed through perch_template, it is formatted with html tags. In this instance, I don't want the html tags, so in my template I have added the "striptags" option. However, the resulting output still has the html. Is this expected behaviour? Or should perch_template be honouring those attributes?
Setting the "raw" option on perch_content_custom obviously removes html tags, but I end up with underscores etc in the text from textile.
Cheers, Dunc
So you're basically saying that the
striptags
attribute isn't working for you?Can you show us your template tag?
I suppose that's the gist of it....
Some of the processes I'm using are a bit convoluted - I've integrated Perch into an existing CodeIgniter website. Here is how the region is created:
The news_item template is as follows:
This sets up the backend for entering the region items.
Later on, I need to re-use some of this data for some html meta tags:
The template I am then using is as follows:
This is the browser output:
Anything else you need, let me know.
Can you try adding
html="true"
to the same tag? It may be that it's being escaped first, so the tags aren't there to strip.That's done it Drew.
Having read that again, I think I've seen you recommend that to others on the forum, but the docs push you away from it as soon as you use textile or markdown...?
Thanks for the help, Dunc