How to Create a Page in Silex
Written by Antonin Wednesday, 5 December 2012
When you use Silex the page creation is based on an icon system.
To create a new page, you must declare a clickable component as an icon on the start page.
For example, from your home page you want to access a service page and a contact page. To do so, you will add 2 clickable components on your home page (see the list further) ; you will declare them as icon by checking the “icon” box and you will enter the page’s name they will open.
Then, when you will click on the “LabelButton2″ from the home page, it will open the service page
And when you will click on the “LabelButton3″ from the home page, it will open the contact page:
As you can notice, the creation of a page corresponds to the creation of a layer.
When you edit page’ name , think that it’s that name that will be found in the URL of your site.
List of the clickable components that can be used as icon
* geometry components
Different way to create pages
▪ Declare a clickable and visible component as an icon
It’s the case explained at the beginning.
▪ Declare a clickable and invisible component as an icon
In that case, you take a clickable component and make it invisible (just uncheck the “visible” box). Declare it as an icon and enter the page’s name to open.
If you want to open the created page, you must enter the following action on a clickable component: onRelease open:path/of/your/page
This way of creating a page is useful when you want to “avoid” some of constraint of parent /children layers principle.
Example: on your “start” page you want to access a “company” page. You are going to put an icon on the “start” page to open the “company” page. Then, from the “company” page, you want to access a “services” page but you don’t want to have the content of the “company” page on it (cf parent / children layers concept).
To do so, you are going to declare an invisible component as an icon on the start page that will open the “services” page. And, on the “company” page, you will put a clickable component (that will be visible) with the following action: onRelease open:start/services
▪ Use publication structure plugin
Page creation with the publication structure plugin is used in the case of pdf import template.
▪ Click on “add layer” in the layers toolbox
You have the possibility to click on “add_layer” to create a new page. The principle is exactly the same as the one explained first.
In fact, it’s a kind of shortcut. You can create a page in that way only if there is clickable components on one of your layers.
The “add layer” option proposes you the list of the components (that already are on your publication) that can play the role of an icon, and the list of the layers that can play the role of parent layer.
If in your whole publication you have no clickable components that can play the role of an icon, you won’t be able to add a layer in that way.
▪ Use a RichTextList and a Data Selector
The RichTextList and the Data Selector are that we call “Oof components”.
You find them in the components list when clicking on “add component”. Thanks to them, you can create a dynamic menu to navigate into your publication, without having to put clickable components.
In fact you define your page’s name in the rich text list and the labels you want to display on the stage. Then you connect the Data Selector to this rich text list. ; it’s the data selector that will play the role of the icon.
That’s all for the page creation!