Incorrect Templates Loading
When we try to use the plugin on template groups with more than one template (in this case, index and .detail), it always defaults to index and displays the wrong content. The issue that we've found is in the redirection within the plugin. We use the presence of segment 2 to determine whether or not a page is a detail page or a listing page. Since the plugin always redirects to template_name/index, we always see a listing page regardless of the URL.
Our logic looks like this.
{!-- Detail page --}
{if segment_2 != 'index'}
{embed="{template_group}/.detail"
template_group="{template_group}"
channel="{channel}"
category_group="{category_group}"
}
{/if}
{!-- Full listing page --}
{if segment_2 == 'index'}
{embed="{template_group}/.list"
template_group="{template_group}"
channel="{channel}"
category_group="{category_group}"
}
{/if}
The plugin functions perfectly well in every other template group, but it seems to get hung up here.
The example structure of this category is like this:
somewebsite.com/eat/rendezvous-lodge
When I output the URL segments of that page, I get segment 1 as
mobile__eat, segment 2 as index and segment 3 as blank, so the
content never displays properly.
Thanks in advance! I love your plugin and look forward to recommending it to everyone.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Wouter Vervloet on 10 Jan, 2013 10:39 PM
Hi Justin,
I believe it has something to do with the
{template_group}
variable you're using. Are you using some add-on that adds that variable or have I missed something that has been added in the latest version of EE? I believe that the{template_group}
variable isn't the same as{segment_1}
.May I ask which version of EE you're using?
– Wouter
2 Posted by Justin on 10 Jan, 2013 11:17 PM
We set those variables at the top of the template like this
We're currently running 2.4.0
Thanks again!
Support Staff 3 Posted by Wouter Vervloet on 10 Jan, 2013 11:33 PM
Ah, I think I see what is going on here...
Mobile can only alter the topmost template that is being loaded (in this case 'eat/index'). Templates that are embedded can't be altered by any addon (not yet at least).
You will have to set the
{template_group}
variable tomobile__eat
to embed the right template.– Wouter
4 Posted by Justin Ferrell on 10 Jan, 2013 11:46 PM
We will have to test to make sure that we can do it and keep the
correct content in place.
Justin Ferrell
Mobile Developer @ Digital Relativity
[email blocked]
@mobile_justin
304-719-7410
Sent from my iPhone
5 Posted by Justin Ferrell on 11 Jan, 2013 02:26 PM
Is there no conceivable way to make it work? I ask because we didn't build the entire site we're looking at. The agency that made the desktop site wasn't able to do mobile (no idea why) so we're just adding the mobile version to an existing site. Trying to avoid having to alter the desktop site and content structure if at all possible.
Support Staff 6 Posted by Wouter Vervloet on 11 Jan, 2013 03:11 PM
What is the exact template group this template is a part of?
– Wouter
7 Posted by Justin Ferrell on 11 Jan, 2013 03:12 PM
This template is in mobile__eat, and we want it to mirror the content
and URL of the eat group.
Justin Ferrell
Mobile Developer @ Digital Relativity
[email blocked]
@mobile_justin
304-719-7410
Sent from my iPhone
Support Staff 8 Posted by Wouter Vervloet on 11 Jan, 2013 03:26 PM
Not sure if you have this already, but do you have the
{template_group}
variable set to'mobile__eat'
?– Wouter