22402 Posts in 6882 Topics by 2748 members
General questions about getting started with SilverStripe that don't fit in any of the categories above.
|Go to End|
28 June 2011 at 8:57am
I'm playing around with custom shortcodes, and creating custom parsers, and the two don't seem to play well together.
I want to create a custom parser that will parse the content on each page, and, for example, find every link that leads to a PDF, and automatically add some text to the end of the link that says something like "(PDF, XX kB)". Since I want this to happen to every link, I figure it's best to use a custom parser, rather than a shortcode. (Is that correct?)
However, I also want to be able to use shortcodes on the same page. I'm working on a shortcode that will display an automatically generated list of all the subheadings on a page with a same-page link to each heading, and I want the person using the CMS to be able to place this list anywhere on a page, so I'm guessing that would have to be done with a shortcode and not a parser?
So I've worked out how to create a custom parser and apply it to my content using something like "$Content.Parse(LinkParser)" instead of "$Content" in my template file, but then the shortcodes aren't parsed. They only get parsed if I use "$Content".
Is there a way to get my content to be parsed by my custom parser, and to be parsed by the regular parser that does the shortcodes? It doesn't matter to me in which order the parsers are applied - just as long as both of them are applied.
Is that possible?
|Go to Top|