Timeline for Determine Entry based on URL Parameters?
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 18, 2015 at 15:28 | vote | accept | Christopher Healey | ||
Feb 18, 2015 at 8:35 | history | edited | carlcs | CC BY-SA 3.0 |
edited title
|
Feb 18, 2015 at 8:28 | answer | added | carlcs | timeline score: 7 | |
Feb 18, 2015 at 8:27 | history | edited | carlcs | CC BY-SA 3.0 |
added 36 characters in body; edited tags
|
Feb 17, 2015 at 23:06 | answer | added | Douglas McDonald | timeline score: 5 | |
Feb 17, 2015 at 11:01 | comment | added | Christopher Healey | What i've done is wrapped the entire thing in a for loop , changed 'entry' to 'entryonpage' since that is what i use in my for loop and set this at the top of the for loop: {% set theID = craft.request.getParam('entryId') %} {% for entryonpage in craft.entries.id(theID) %} this all seems to work. Let me know if i'm doing something incorrectly it seems pretty convoluted, but that could just be because i've been staring at it and tweaking for hours haha. | |
Feb 17, 2015 at 10:56 | comment | added | Christopher Healey | Yes I am sure there is an entry with the id of 170. | |
Feb 17, 2015 at 1:26 | comment | added | Brad Bell♦ | Are you sure you have an entry with an Id of 170? | |
Feb 17, 2015 at 0:42 | comment | added | Christopher Healey | Brad. Essentially yes, that's a part of it. I moved my code a bit to test what the write code is and wrote this: {% set testvariable = craft.request.getParam('entryId') %} <h1>{{ testvariable }} - {% for entry in craft.entries.id(testvariable).first() %} {{ entry.title }} {% endfor %}</h1> and i get an error Impossible to access an attribute ("title") on a string variable ("170") if i put the 'testvariable' in quotes then it doesn't throw an error but no title is output. If i know how to grab an entry by a parameter in the url query i think i could sort the rest of this out but im stumped now. | |
Feb 17, 2015 at 0:35 | comment | added | Brad Bell♦ |
I'm confused, too... are you just wanted to manually grab an entry by its Id? set entry = craft.entries.id(170).first()
|
|
Feb 17, 2015 at 0:07 | comment | added | Christopher Healey | I've been thinking about it a bit more 'still running on fumes' is there an implied for loop on pages that the system knows there is an entry defined for? If that is the case for pages like my special case where the system does not know automatically what entry it should be showing, do i need to create an additional conditional for loop? | |
Feb 17, 2015 at 0:05 | comment | added | Christopher Healey | Hey calcs it actually doesn't have much to do with that. I'm running on fumes here. I have a variable "activeTitle" that gets set based on whether there is a manual title 'pageTitle' defined on the parent template or not. If there is not one, it uses the 'entry.title'. I have special case where a query is output 'such as shown in that link' and i need to define what 'entry' that particular query is calling so that the variable 'activeTitle' can be defined. As of now it's a null variable. I basically need to let the page know, what entry should be being called based on the query string in url. | |
Feb 16, 2015 at 23:38 | comment | added | carlcs |
What do you mean with "'set' 'entry'" and which URL parameter should be relevant? All? I am confused, sorry. And what does this have to do with "entry title" or the code setting pageTitle ?
|
|
Feb 16, 2015 at 22:01 | history | asked | Christopher Healey | CC BY-SA 3.0 |