tag:support.baseworks.nl,2011-05-09:/discussions/mobile/61-incorrect-templates-loadingBaseworks: Discussion 2016-08-11T08:53:51Ztag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-09T13:06:58Z2013-01-09T13:06:59ZIncorrect Templates Loading<div><p>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.</p>
<p>Our logic looks like this.</p>
<pre>
<code> {!-- 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}</code>
</pre>
<p>The plugin functions perfectly well in every other template
group, but it seems to get hung up here.</p>
<p>The example structure of this category is like this:
somewebsite.com/eat/rendezvous-lodge<br>
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.</p>
<p>Thanks in advance! I love your plugin and look forward to
recommending it to everyone.</p></div>Justin Ferrelltag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-10T22:39:26Z2013-01-10T22:39:26ZIncorrect Templates Loading<div><p>Hi Justin,</p>
<p>I believe it has something to do with the
<code>{template_group}</code> 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
<code>{template_group}</code> variable isn't the same as
<code>{segment_1}</code>.</p>
<p>May I ask which version of EE you're using?</p>
<p>– Wouter</p></div>Wouter Vervloettag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-10T23:17:44Z2013-01-10T23:17:45ZIncorrect Templates Loading<div><p>We set those variables at the top of the template like this</p>
<pre>
<code>{!-- Preloads
=====================================================================
Use these variables to configure the content from ExpressionEngine
for this site. --}
{preload_replace:meta_keywords=""}
{preload_replace:meta_description=""}
{preload_replace:channel="eat"}
{preload_replace:template_group="eat"}
{preload_replace:disable="category_fields|member_data|pagination"}
{preload_replace:taxonomy_tree="3"}
{preload_replace:taxonomy_node="4"}</code>
</pre>
<p>We're currently running 2.4.0</p>
<p>Thanks again!</p></div>Justintag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-10T23:33:26Z2013-01-10T23:33:26ZIncorrect Templates Loading<div><p>Ah, I think I see what is going on here...</p>
<p>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).</p>
<p>You will have to set the <code>{template_group}</code> variable
to <code>mobile__eat</code> to embed the right template.</p>
<p>– Wouter</p></div>Wouter Vervloettag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-10T23:46:04Z2013-01-10T23:46:04ZIncorrect Templates Loading<div><p>We will have to test to make sure that we can do it and keep
the<br>
correct content in place.</p>
<p>Justin Ferrell<br>
Mobile Developer @ Digital Relativity<br>
<a href=
"mailto:justin@digitalrelativity.com">justin@digitalrelativity.com</a><br>
@mobile_justin 304-719-7410</p>
<p>Sent from my iPhone</p></div>Justin Ferrelltag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-11T14:26:09Z2013-01-11T14:26:10ZIncorrect Templates Loading<div><p>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.</p></div>Justin Ferrelltag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-11T15:11:29Z2013-01-11T15:11:29ZIncorrect Templates Loading<div><p>What is the exact template group this template is a part of?</p>
<p>– Wouter</p></div>Wouter Vervloettag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-11T15:12:42Z2013-01-11T15:12:42ZIncorrect Templates Loading<div><p>This template is in mobile__eat, and we want it to mirror the
content<br>
and URL of the eat group.</p>
<p>Justin Ferrell<br>
Mobile Developer @ Digital Relativity<br>
<a href=
"mailto:justin@digitalrelativity.com">justin@digitalrelativity.com</a><br>
@mobile_justin 304-719-7410</p>
<p>Sent from my iPhone</p></div>Justin Ferrelltag:support.baseworks.nl,2011-05-09:Comment/236347052013-01-11T15:26:15Z2013-01-11T15:26:15ZIncorrect Templates Loading<div><p>Not sure if you have this already, but do you have the
<code>{template_group}</code> variable set to
<code>'mobile__eat'</code>?</p>
<p>– Wouter</p></div>Wouter Vervloet