0

I am trying to use low variables and the grid together to allow the client to create dynamic pages. I have the grid set up to create a title and then another field for the page content. I want to list the page titles on the side and when clicked shows the corresponding page content.

Is this possible? I have it currently populating the side column with the page titles with this code:

{exp:low_variables:pair var="lv_patient"}<li><a href="{path="patient/{exp:create_url_title}{lv_patient:page_title}{/exp:create_url_title}"}">{lv_patient:page_title}</a></li>{/exp:low_variables:pair}

I am then pulling in the page content with:

{exp:low_variables:pair var="lv_patient"}{lv_patient:page_content}{/exp:low_variables:pair}

Which just pulls in all the content not the stuff specific to the corresponding title.

  • Perhaps a dumb question, but why would you not use the native channels and fields to create pages? – Jeremy Gimbel Jun 5 '14 at 18:18
  • Mainly because these pages will all be static but I still want the client the ability to access and create them easily. – Matthew Carleton Jun 5 '14 at 19:58
  • I'd agree with Jeremy - it's like you are using EE for content management but then not wanting to use EE for content management. "pages will all be static but I still want the client the ability to access and create them easily" - describes a goodly share of sites built on EE. Keep it native and keep one content management workflow for your clients. – Michael Boyink Jun 5 '14 at 20:43
  • See my comment below. I have pages that won't be created very often if ever, so I want it to be less dynamic as far as parsing on the page. Correct me if I am wrong but I think using something like low variables is less taxing then parsing exp tags? – Matthew Carleton Jun 5 '14 at 20:55
  • It's unlikely that using Low Variables, especially with Matrix would have any performance benefit over a properly written channel entries tag. – Jeremy Gimbel Jun 5 '14 at 23:08
1

I tend to agree with what's been said about LV versus regular Channel Entries in your case, but to actually answer your question...

I'd add a column to the LV Grid var, eg. url_title, where you enter a slug for that row. Then, using that slug in the URI, you can use the search:column_name parameter on the Pair tag to filter out just that row:

{exp:low_variables:pair var="my_grid_var" search:url_title="={segment_3}"}
    ...
{/exp:low_variables:pair}

Note the = inside the parameter search:url_title to trigger exact matching. Also, it doesn't have to be a 'url_title', but can be any column name that you can use to uniquely identify a row.

| improve this answer | |
1

Modular pages

I have created dynamic/modular pages in the past. My favourite method so far is to create a set of modules as channels:

  • video module
  • Text Module
  • Text and Image module (image left/image right setting)
  • etc

I then create a modular page channel which is essentially just a title and a relationship/play field. Clients can then create and publish modules and then assemble / order these modules to create pages.

It is possible to reuse modules in various pages and, should the client need other modules, they can be easily created. Clients has maximum flexibility, while I retain as much control on the outputted code as possible.

Low variables

Regarding low variables, I look at it as global variables on steroids.

  • Make all the bits and pieces of content that do not belong in a channel editable easily by the client (including "advanced" stuff like configuration options (yay for early parsing), homepage slider content, etc).
  • Nice replacement for native snippets (the save as text option is a god send if you use git).
  • etc
| improve this answer | |
  • I've thought of this route, but it just seems like overkill for pages that won't need to be edited very often. When using the EXP tag it has to parse through a bunch of stuff that I won't need. I have it working with Low variables but I have to use the row id in the url which makes for ugly urls. – Matthew Carleton Jun 5 '14 at 20:00
  • For pages not needing to be edited very often, i just create one group per page and use the fields I need with Low Vars. Pretty neat for users and nicely separated from the rest of the site content. Those pages are usually not modular, though. – Jérôme Coupé Jun 12 '14 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.