Search

Hello Symphonians!

I'v had one eye one Symphony for a few years but up til now the threshold has always been a little bit too high to not use my own php function libraries and cms templates i'v built up trough the years to meet deadlines.

However, with some spare time and a need to learn something new, now is the time!

I have some various questions, if there are information on these already, please don't hate but direct me in that direction. Everything is a little bit overwhelming right now :)

  1. If i want to have a section called "Pages", basically containing a Title textfield and a content Textarea, that should be pulled out from the database by domain.com/identifier, how do i do that?

I'v figured out that you can use "domain.com/page/identifier" to call entry x from pages datasource, but if i want this from root? And also it should still allow other sections like mydomain.com/news/article.

  1. I need to locally fetch data from some external xml files and display it on various places on the site. Whats the best practice for that?

What i can come up with:

– Create a section and then inject data to its corresponding database tables with a cronjob ;) Or just include a external file.

  • Dive into extension creating?

Whats the best practice here? Any tutorials or solutions i should be aware of?

  1. I installed CKEditor, but it does not seem to allow direct upload of images in the text editor. Something i feel is more or less a must. Is there any solution?

Many thanks in advance, i will with no doubt gather many more questions in a moment :)

If i want to have a section called "Pages", basically containing a Title textfield and a content Textarea, that should be pulled out from the database by domain.com/identifier, how do i do that?

This is a pretty common request. Try searching the forum to see how others have dealt with it. The URL router extension could prove useful.

Definitely try following the Say Hello to the World and Say Hello to Symphony tutorials. They walk you through how to use Symphony to achieve some very common tasks, and they will get you more comfortable using Symphony’s backend. When I first tried Symphony I was very confused and not really sure what was going on, so I abandoned it. The second time I tried it, I followed the tutorials and realized how easy it is to do some things that would be a pain in other CMSes.

Take your second requirement, for example:

I need to locally fetch data from some external xml files and display it on various places on the site. Whats the best practice for that?

This is exactly what dynamic data sources are for. Symphony excels at retrieving XML data, which you can then process using your XSLT templates. The tutorials above walk you through how to do that with a Twitter feed.

Dive into extension creating?

Once you have an idea of what you want to do, try looking for an existing extension that is similar in concept. For example, when I wanted to create my first extension, Brendan recommended that I take a look at his Custom Field Captions extension. Looking at the code gave me a good idea of how to accomplish things.

The API is also quite useful, especially because it links directly to the Symphony core code on GitHub, so you can always see exactly how a function is doing something.

Hi and welcome retypejonas,

Apologies in advance: I have little time to answer your questions in full but thought to type a quick reply to get you going ;)

Fetching a 'page' (entry of a Symphony Page Section) at domain.com/page/page-title you would indeed create a Symphony Page with URL Handle page and URL Parameter title. Then you would create- and attach a 'fetch-page-by-title' Data Source (DS) that queries the DB for the Page entry with a title field (@handle) value that corresponds with a given title URL parameter (page-title in my example).

When you want to remove the need for the /page/ URL fragment you could use an extension such as Root Page Params

Importing 'static' XML into a Section is really easy in Symphony with so-called Dynamic XML or Static XML Data Sources:

Create a new DS and choose Dynamic- or Static XML from the Source dropdown. Now simply point to your dynamic- or static XML location and you're set.

Alternatively you could take a look at the XML Importer extension

I have not used the cKEditor recently but I believe it incorporates a 'File Manager'. Most often though you would have a Symphony Section 'Images' instead of 'static' files from your file system. You can also use Subsection Manager for these and 'drag/drop' the image in your CK-Editor.

Gottago, but hopefully this will help you on your way...

Woah: complete synchronized double-post-ness! :)

Thanks a lot! Impressed by the quick responses..

I will read trough the tutorials and links you provided and get back... i think i rejected those "Hello World" articles for being too basic as they use to be in any other language/system introduction.

I'm very impressed with the flexibility of Symphony, and i can really see how this can reduce a lot of those time consuming and want-to-change-career situations of constructing forms and sql queries for every piece of a custom CMS. Hope i will hang in long enough to really "get it" this time :)

I wish the default templating could be a liittle bit less modular than they are. Even though i can see the elegancy and would probably code like this when im getting confident, it's confusing when each template is like five lines of code and spread out in different files.

The templating can really be however you choose, the tutorials just advocate for best practices. My first Symphony site completely used single-page templates and for-each statements... It worked fine for the time, but I started to see how reusing bits of code could help me out later.

Yes i definitely agree that modular style is best practice.

But jumping around in too many files is confusing for a crash course :)

Any advice of a tutorial or complete theme i can look at that use more or less single file templating?

I hit a wall sooner than expected and even have trouble displaying a list of items from my data source in a page, so i think it's needed. Hehe!

Update: This one seems to cover the basics i need!

http://designprojectx.com/tutorials/beyond-hello-an-xslt-page-template/

Hi @retypejonas. Say Hello to the World step 4 is about templating.

It's really worth starting slowly and making sure you understand what's going on.

Thanks,

I'm trying to go slow and understand what i'm doing. But i guess im too restless to follow all tutorials step by step. Sorry for that..

A new problem, if anyone is up for it – managed to create mydomain.com/clients/ that lists data from the clients section and links each to mydomain.com/clients{name/@handle}/

When i click one of these, the handle appears in data->params->name in the XML.

But it still shows the clients.xsl template listing them all. What would the correct way to change template to show a single record template and use another data source?

I created a new data source called "Client" and added {name} as filter on the Name field according to the articles, but i don't get how i hook it up.

The articles seems to cover how to do it by linking to mydomain.com/newly-created-hidden-page/handle where newly-created... is assigned the template for single view and the new data source. Is that the way to go if i don't want to get to complex or am i missing something?

The thing is that you would normally have two different Symphony Pages (and thus -templates) for each view: one 'list' Page (/clients/) and one 'detail' Page (/clients/client/{$client-name}).

Only the last Page (detail view) needs a URL param (client-name).

So, normally you would not have one Page/template deal with both the list- and the detail-view.

You can do it however: but it is not a 'best practice'. What you would do if you absolutely need this is to have one template and simply 'check' for the available detail-content (with e.g. an if/else construct). If there is a $client-name param and corresponding Client Detail content you show the detail view, else: show the list. But again: better to hande with two different Pages/Templates

So,

This is complex / not good practice?

domain.com/clients/ <- should use one template and datasource

domain.com/clients/client-x/ <- should use another template and datasource

domain.com/clients/client/client-x/ looks silly i think,

Then probably better go with

domain.com/client/client-x/

But i guess you agree clients/clientis much better logic for the visitor? I usually drop a folder of the url if i want to go down in the hierarchy of a site i visit. Also makes more logic for breadcrumbs etc.

I think you can do what you wish to. Go through the 'Hello' tutorials and it will likely become clear how.

@retypejonas

I agree that it looks 'silly' when you first encounter it (this website uses the same structure, check out e.g. /blog/ (list) and /blog/*entry*/blog-x (detail) and /../*view*/foo-x.

Still: while it can be done with one page/template (with e.g. a if/else construction in your template and two DS'es) it is not as clean: you need to attach a lot of unneeded content to a page (2 DS'es) and you need some extra XSLT construct to allow for both a List and Detail markup.

Or you could use an extension such as Root Page Params or Redirect to handle this.

I, however, have come to see the /clients/client/client-x construct as not so silly after all ;)

Thank you all, appreciate your help!

Sorry if my choice of word, "silly" made you a little bit upset. Wasn't my purpose...

I went with clients/view/client-x , looks decent enough and i think my first trial and error project in Symphony should stick to Symphony conventions and not rely on hacks.. i'll save those for later!

Next problem i encountered is how to get "client x" in the title tag, now it says just "Client".

I can see there is a root parameter in the xml called page-title, it would be nice to get it in there?

I, however, have come to see the /clients/client/client-x construct as not so silly after all ;)

I'm a bit confused about this discussion about good or bad practices in this context. Symphony is a flexible system and it allows both setups: /clients/client-x and /clients/client/client-x. How you setup your page parameters should not interfere with how you setup your templates - although it's important to distinguish in this context if we talk about a template file (which is our stylesheet) or an XSL template (<xsl:template />).

In my eyes there is no best practice how to setup your parameters and wether to use nested pages or page parameters. It all depends on your projects needs.

Well, the main issue is that i couldn't find out how to use the url scheme /clients/client-x where /clients loads one XSL template with one datasource, and /client/client-x loads another set of XSL/DS and uses client-x as an url parameter at the same time.

And getting the impression that that wasn't "a Symphony way" of doing it, i just wanted to argue that /client/client-x is, in my eyes and in most cases, a more pretty URL.

However, this is not a big issue. In particular not for this project. This topic went a bit too far i think.. at least as a part of this thread.

"Symphony-internally" I see it as a good practice to use separate pages for separate views.

Transforming /clients/client/client-x into /clients/client-x can always be done afterwards using the URL router. The pages, your DSes and the code stay the same, the router just re-routes the request.

Allright, thanks. Will give the URL router a try later on.

Any help on how i can add data from the page parameter for $page-title?

In other words, what's best practice to get

This is how I'm doing it at the moment:

<title><xsl:value-of select="$page-title"/><xsl:text> &#8212; </xsl:text><xsl:value-of select="$website-name"/></title>

I have a very basic XSLT utility I like to use as a starting point.

@Nils Sorry for the confusion on my part: I tried to explain that Symphony is flexible enough for most scenario's but that it's 'probably better' to use different Symphony Pages (with their own DS and Templates) for different views (e.g. 1 Page for List-view and 1 for Detail view). This is what @phoque is saying as well.

@retypejonas re: the Title information: at the moment it simply shows the Symphony Page Title (the title of your Symphony Page: 'Client'). If you want it to show the current client's name you will need to create/edit the XSL code being used for the HTML <title/> element.

You could add some logic in that XSL template: on the homepage show a different String, on a List view display "All Clients" and on a Detail view display the Client's Name. etc. Much like what @DavidOliver does.

If you want to have even more control you could create a specific <xsl:template/> for the HTML <title/> so that you can override this on specific pages.

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