Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-02-26 16:36:56

Registered: 2023-02-17
Posts: 108

site_url inside article

I use <txp:site_url /> to show images, works inside pages and forms, but doesn’t work inside article

<img src=”<txp:site_url />images/image1.jpg”/>

inside article, closing > converted to &gt;

when I check the page source, shows as below:
<img src=“http://localhost/textpattern2/images/image1.jpg”/&gt; <— this closing cases the issue.

any idea ?

Thank you


#2 2023-02-26 17:55:09

From: Cyprus
Registered: 2004-11-20
Posts: 8,941
Website GitHub Twitter

Re: site_url inside article

To make sure that your code will not be touched by textile, you can surround it by using ==

==<img src="<txp:site_url />images/image1.jpg"/>==

neme.org | hblack.net | EMAP | A Sea change | NeMe @ github
I do my best editing after I click on the submit button.


#3 2023-02-26 18:07:34

From: Leeds, UK
Registered: 2006-01-29
Posts: 10,976
Website GitHub

Re: site_url inside article

Further to what colak said, if you’re not using any other features of Textile in an article you can elect to turn it off completely by switching the drop-down above the textarea to Leave Text Untouched.

To ‘escape’ something that you wish to display verbatim without Textile misinterpreting it, you can either surround it with double equals as mentioned above, or use notextile. (plus a space) at the start of the line or, in some cases depending on how complex the content you’re escaping is, begin the line with two spaces.

If you do choose to turn off Textile processing completely, you can still process individual blocks of content in the article by surrounding them with a tag and telling it to consider it as Textile via the escape attribute. E.g.:

<txp:evaluate escape="textile">
* I am a Textile list
* Comprising a few bullet points
* Like this

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp


#4 2023-02-26 19:19:02

Registered: 2023-02-17
Posts: 108

Re: site_url inside article

Thank you both for reply,
Both didn’t work, treated as text, in that case didn’t show image,
but Bloke’s suggestion worked when I changed article format to “leave text untouched” the image showed up nicely !

again, thank you both.


Board footer

Powered by FluxBB