Search

Whenever we post a page/post at the moment we have to insert all the links manually, after the writers do their post.

For efficiencies' sake we were thinking of creating a new section with the keywords and their links and having an automatic script adding these links in.

However not to oversaturate the links (ie having too many links on one page) I was thinking of something based on javascript. Checking the content section and adding the links, so this would allow me to put up a popup asking if the user would like to insert the particular link for that keyword.

In order to pass the datasource to the js functions, the only way I could think of is via an ajax request, that calls an admin page that returns the data. Not sure if this is going through the right path or if there is a way to pass this information through a page-load delegate. Load time is not really an issue since this is for the admin rather then client side. Any advice would be greatly appriciated :)

If I understood correctly, you are trying to do something like wikipedia, where all keywords are automatically created into links?

If this is the case, there are two easy ways to solve this:

  • You could transform the text using XSLT on the frontend. You should be able to match all words outputted by a datasouce using the ninja technique. Replacing them with a link should be relatively easy.
  • Because load times using the above might become unacceptable with alot of different keywords, you could also create an extension that acts as a text-formatter, storing the generated HTML into the database rather than generating it on every request.

Perfectly understood.

However someone came up with an issue where you might have duplicate keywords on the same page and it would look unprofessional to link all, or only the first instance. So they would like the opportunity to choose which one to link. Plus not all of the keywords might be linked as we do not to see a pagefull of links.

So I was thinkking of a twist prior to submitting the form, and popping up some Javascript asking what is to be linked. (obv links and keywords would have to be loaded in some javascript array)

My question is how can I pass the data from a section/data source into this javascript... since javascript I can load it via a delegate however not sure how I can pass all that data.

My question is how can I pass the data from a section/data source into this javascript... since javascript I can load it via a delegate however not sure how I can pass all that data.

Ok, I see the problem here. What you could do is create a page with a datasource fetching all the keywords, and output it in JSON. (I believe there is a utility for that).

This is not the neatest way, but I think it is by far the easiest.

However, if you are comfortable writing your own code, you could add a backend page by creating an extension. (Look for the content folder of some extensions for more help). This page can query the database directly and output (once again) in json. If you are going for this (more complicated) method, take a look at the subsection manager, I believe Nils is outputting entries as JSON there.

Does that help?

Yep very helpful. In the end I think I am going for something similar.

I am creating an Admin page - which returns XML data, I can then parse this through JQuery, would be very similar to using a JSON object however this way I can keep most of my system within symphony structure rather then additional extensions.

So I created a section, data source and page and i am outputting xml, which is fetched by my admin JS to implement the link functionality. PS my content is also multilingual so this XML/jQuery concept allows me to change multilingual data before it is posted to avoid more confusion.

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