Search

Is there a way to have short codes in the text? If I for example want to mix in several galleries with my text on a user specified places, how would I do it?

In the previous CMSs I have used short code which goes something like this [gallery (ID)].

I guess I could use associations to connect selected galleries to my article, but how can I call them within my content?

I could, for example, solve this with JavaScript by parsing main content for my short code, outputting all galleries as a JSON within <script> tag and than inserting them in order, but that is faaaar from good practice and being elegant and future proof.

You can parse and replace your text content with XSLT, similar to how it would work in PHP or JavaScript.

Hm... something like regex replacement? Do you know of any tutorial for implementing shortcodes with XSLT?

I'm guessing I wouldn't be able to call XSLT template with arguments on place of my regex match, it would be plain character replacement, and I'd have to make XSLT function to prepare string.

Is that the right approach?

This might be a good place to start

http://www.getsymphony.com/download/xslt-utilities/view/26418/

A Hanna code extension would be pretty nifty - wouldn't mind tackling it myself one day when I get some free time again!

Depending on the users, would it be any harder to use a custom element? For example <gallery id="123" />, and then do the replacement in XSLT with the Ninja Technique.

there're textparsers available as extensions, right? So, shouldn't it be possible to add a shortcode text parser extension an make it available in the parser selection of the text field?

Just came across this - I've done this before. You should have a look at - http://symphonyextensions.com/extensions/templatedtextformatters/

It allows you to create / add and chain text formatters. If not mistaken you can create patterns and have insert HTML or XML tags in the Formatted value, then you can use XSLT to finish off. Of course you can create a custom formatter to do anything you want. I used to use [image='1'] to match the first image in a subsection manager list or [link='123'] to generate a link to Entry 123.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details