Not allowed to create a same variable name for different scope in admin panel
Hi Admin,
I have globally defined certain variables but I would like to alter them at the page level, which works great with the variable file, but I am not able to do the same from the site variable section from the admin panel(database level).
I am trying to create page_title variable again from the admin panel. One without the scope which will be a default entry while the other will be scope driven for specific page. The variable is page_title and should be affecting the URL about-us/who-we-are.
Please correct me if I am wrong : If we are working for the page on about-us/who-we-are URL then on the admin panel
scope will be about-us/who-we-are similar to $pages['about-us/who-we-are'] in the about-us.php variable file.
Comments
I used the opt-in controller method to get my routes working and passed all the details and info from the variable file to the route.
I created the layout file as per my requirements If you take a look at the layout file, this file is built to be used in different routes.
I have a route about-us/who-we-are and about-us/brand using the same layout file.
My _varaible/about-us.php file looks like below: I also had to create the view file for the route, which can be kept blank as well, but I have kept a line of code for understanding and also some comments for each of the views.
View at the location views/about-us/who-we-are.php look like below: I tried to create the page with the given layout from the back-end but I didn't got the options to add the variable values like we get while selecting the main layout (automatically all variables are displayed in admin panel for admin to add entry into them for specific page)
So, I created a page and now creating page specific variable via site variable section.
After defining the variable once without the scope(global variables applicable throughout the site), the variables like page_title, layout, meta_keywords or any of the variable created once is not allowed to create again. PFA the screenshots https://ibb.co/hr1245 and https://ibb.co/g3Vej5
I am not sure whether I am heading the right way for making _variable file driven pages to be updated from database.
- When I try to setup a page in the admin page and select my custom layout (code shared above in my previous code), I am not getting the variables associated to the layout in the admin panel. I tried to debug the code for layout change event but didn't got anything substantial.
You can then use the controller if you would still like and pull in the variables created in the Pages module for your page
- Are you referring that while import, if the variables are defined at the controller level then they would be pulled while creating the page in the admin panel! or your just informing that the variables created as per first point on this comment can be used in the controller as well!
Sorry, but this my first time with Fuel, I may sound naive! Thanks
If the latter, for that to work, you need to first specify a layout that has field names that match the variables you are wanting to import.
Where can I specify the layout with field names for the variable import to function properly? Any links for reference ?
I already have layout file under _layout folder with the below code
http://docs.getfuelcms.com/general/layouts