2012-07-05 16:07:43

MarcoK
Plugin Author
êta
Real name: Marco Casalegno
From: Como
Known languages: Italiano- English (not well) - Francaise (pas bien)
Website

Parse an article before post on frontend

There is a way to parse with custom php function an article before show on frontend without modify the code saved into database?

I’m serching a way to transform url into hyperurl and youtube url into embed video like a classical forum function,
or a way to transform smily code into image.

Any ideas?

Offline

 

2012-07-06 07:34:06

milosevic
Member
iota
Real name: Jorge Hernández
From: Madrid, Spain

Re: Parse an article before post on frontend

Maybe smd_macro can help you.

With it you can build your own txp functions like “<txp:video id=“youtube-video-url”/>, in some way it is like using txp:output_form in articles but more simplex and powerfull.


<txp:rocks/>

Offline

 

2012-07-06 09:21:19

etc
Plugin Author
mu
Real name: Oleg
Known languages: ru, fr, en, google.translate(*)
Website

Re: Parse an article before post on frontend

For simple replacements (smileys, and so on), an7_filter works well. For more elaborated ones, you could try etc_query, though it may be tricky:

<txp:etc_query data='<txp:body />' replace="//a[contains(@href,'youtube')]@@src={[@]href}@href@#=iframe" />

will work for embedded videos, like in <a href="http://www.youtube-nocookie.com/embed/oNvb2SjVjjI?html5=1">AdBlock Plus</a>, if you put it instead of <txp:body /> in article form.

Last edited by etc (2012-07-06 09:30:22)


etc_[ query | search | link_to | pagination | date | url ]

Offline

 

2012-07-06 10:27:48

MarcoK
Plugin Author
êta
Real name: Marco Casalegno
From: Como
Known languages: Italiano- English (not well) - Francaise (pas bien)
Website

Re: Parse an article before post on frontend

Thanks Milosevic and etc

an7_filert is a good idea to start my plugin…

Offline

 

Powered by FluxBB