5

I am working on a complex EE site (version 2.5.2) that I've been handed that has a large number of templates. I wish to customize the template for a specific entry. I have created a duplicate of the template that an entry item is using. I wish to change that template to accommodate a design change. The original template for that entry item is "index" and the new template is called "graduate-program" However, when I edit said entry item, and then use the "template" dropdown menu to change the template assignment to "graduate-program" and click "submit" the entry's template does not change. It remains the "index" template.

Any ideas on how to resolve this?

Update: more details:

The channel in question has 8 channel entries associated with it. I wish for one of the 8 entries to use a unique template.

Snippet from the currently-selected template. This allows me to confirm via view source which template EE is applying to the content:

{embed="common/_header"}

<!-- academics/index -->

{if segment_1 == "academics" && segment_2 !="" && segment_2 !="a"}
{if segment_2 != "" && segment_3 == ""}

The channel entries in question

The entry in question as output via the edit entry page, shows the wrong template as being the current selection. (had to remove external link to screenshot)

Finally, here is what I'd like to use for the template for said item:

enter image description here

Please let me know what other details I may provide for clarity.

  • Are you using Pages module? – Davor Peic Apr 10 '13 at 1:18
  • Pages is installed. Looking at Client Site > CP Home > Module > Pages, I see 6 pages listed, none of which is the entry in question. Perhaps I misread the interface? – Screenack Apr 10 '13 at 1:34
  • 1
    It would be great if you can share some screenshot/s or more about this problem. – Bhashkar Yadav Apr 10 '13 at 4:27
  • Bhashkar My reputation at the time of this post didn't allow direct uploading of images, but I have posted links to screenshots in my original question. – Screenack Apr 10 '13 at 14:47
2

EE doesn't generally follow the conventions of some other CMS's like WordPress where each post can have a specific template assigned to it via the entry screen. Templates are assigned in EE via their URLs, because (as Ian mentions), URLs in EE follow a template_group/template/entry pattern. So generally, you'd change the display of an entry by linking to it using a different template in the URL.

(The Template field you show in the screenshot appears to be the template option for entries which use the Pages module, which is one exception where you can assign a template per-entry.)

However, you could add a new custom field to your channel, called, say, Entry Template (arch_entry_template), and give it two options:

  • Standard
  • Graduate Program

Choose "Graduate Program" for your one-off entry, then save. (No need to save the others as "Standard".)

Then in your academics/index template, within the Channel Entries tag:

{if arch_entry_template == 'Graduate Program'}

    Your new template code goes here

{if:else}

    The old template code goes here.

{/if}
| improve this answer | |
  • Fascinating; thanks for the explanation. Why expose the template selector, then; or is that for the context of a static page? For that matter, how does one convert this a channel entry to a page? – Screenack Apr 10 '13 at 14:00
  • That's a good question - one for the person who setup EE for you in this case. To convert to a page, you'd enter a URI for the page in the Pages URI field (it may be hidden though). Also, this assigns a fixed URL for the page, so if you're linking to these entries programatically in your templates (using {title_permalink="academics/index"} for example), you'd have to make sure your Page URI and URL Title matched - and you won't be able to use features like Next/Prev links on the entry page either. – Derek Hogue Apr 10 '13 at 14:19
  • I feel a eureka moment coming on, thanks to Derek Hogue I just need a little more incubation time here. – Screenack Apr 10 '13 at 14:50
  • Instead of the variable detection for templates, I've went with a custom page template using the pages add-on. Much thanks Derek Hogue and Ian and everyone else! – Screenack Apr 10 '13 at 15:51
0

If you edited a template FILE then it could be that the site is pulling the original template from the database. Have you synched your templates?

| improve this answer | |
  • foamcow yes; I am routinely sync'ing my site as I'm externally editing my styles.css file. The current "Save Template as File" settings for the template/template group is set to FALSE. Even still, this question pertains to template selection for an entry item, so perhaps I misunderstand? – Screenack Apr 10 '13 at 10:23
  • If "Save template as file" is false then the templates are stored in the site's database and NOT as actual files. The files may be there, but they aren't being used. Try editing the template from directly within the CP just to see if a change occurs. – foamcow Apr 10 '13 at 10:52
  • That's not my question. I wish to change which template is applied to a channel entry, i.e., assign more than one template to a channel. So that channel "architecture" has "index" AND "graduate" templates. All will use "index" except for one. – Screenack Apr 10 '13 at 11:16
  • My original title for this question was ambiguous. I have updated it for better clarity. – Screenack Apr 10 '13 at 12:10
0

There is no template assignment as such if you're not using the Pages module (as you mentioned). EE follows a *template_group/template* pattern for Channel Entries so if you want to change a specific template to accomodate a design change you need to give it the same name as the existing one (in this case index).

Backup the old one and rename it to *index_old* or something along those lines, then call your new one index. If it's a Channel Entry then the changes will be applied automatically as it picks up the template based on the URLs.

| improve this answer | |
  • Hrm, I have 7 other channel entries for that specific channel that I do wish for EE to use the existing index template. Otherwise, I would have merely updated the index file. – Screenack Apr 10 '13 at 10:58
0

I still haven't read whether or not you've used the Pages module and whether it's succeeded or failed.

This is almost the definition of the purpose for the Pages module.

Please confirm that applying this template to this channel entry does or does not work via the Pages interface of the channel entry.

| improve this answer | |

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.