Jump to content

Can't get custom template to work


Recommended Posts

Hello! I've got a single client on Processwire and it's completely foreign to me. I've been able to find most things, but they've asked for a custom designed page with a full width header image/section, and then a body block and a right side bar below the header. They're using a landing page template, so I duplicated that, figured out how to add it in the admin, and assigned it to the page. Nothing. It doesn't change a thing.

I feel like I'm missing something obvious. I've made sure all the fields are the same, I tried to set up the parent/child stuff though this page doesn't have a parent that I can tell (though it's under Landing Pages). If I can get the template to actually kick in, I think I can use a bit of code to check for the hero section and load it at the top. I also made a copy of the widget template and set that to load instead of the original. But again, since my main page template isn't kicking in, neither is the new widget template.

I'd just love some tips on what to check or change to get a landing page to actually render what's in the assigned page template.

Hopefully I've used the correct terminology here to make sense.

Thanks!

Link to post
Share on other sites

Hey @Brian Peat,

Sadly I'm not able to answer your question — hopefully someone else can! — but just a quick note: "Landing Pages" is not a native ProcessWire concept, so presumably that's something that the original developer of this site added while setting things up. You also mentioned "widget template", and that (widgets) is another thing that isn't vanilla ProcessWire stuff.

All in all the thing with ProcessWire is that since there's no "one true way to build sites", it can be hard to say much about the site in question without seeing the source code 🙂

Normally all you need for a custom template to kick in is...

  • Create a new template in the ProcessWire Admin and assign fields etc. to it.
  • Create a page and select your newly added template as the template.
  • Add a template file at /site/templates/your_template_name.php.
  • View the page on the frontend and ProcessWire will render it using the your_template_name template and your_template_name.php template file.

In case this is not the normal workflow with this site, I'd start by checking which modules are installed (look for something that might affect page rendering). Then check which template files the site has, and if one/some of those are using URL segments to achieve some sort of custom templateish effect. If at doubt, you can paste some code here — just make sure that there's nothing secret in there (keys or passwords etc.) Hopefully this will lead you to the right direction.

... and by the way: if possible, I'd try to contact the original author of the site. And make sure that they didn't leave any documentation (it'd be the decent thing to do, but obviously not everyone does that...) 🙂

  • Like 3
Link to post
Share on other sites

I wondered. I'm used to Joomla and Wordpress, so this was completely new and confusing for me. I did follow the exact steps, though I made the php file first, then it popped up as an option to choose when I create the new template from the admin area. Something the original dev did must be getting in the way, because it renders exactly like the original template, not my new one. In fact, even though it's chosen for that page, I can literally empty my file and it still renders on the front end. 

I'll dig a bit more and look at the url segments thing. I'm pretty sure they didn't leave any documentation, but I'll ask.

Thanks!

Link to post
Share on other sites

Some things to check which tripped me up when taking over from a previous developer:

  • In site/config.php ensure that the template url & path are pointing to YOUR templates url & path. The default is 'template' however is customisable
  • In Set Up ->Templates -> [your template] -> Files tab, that your template file name is not being overridden in the Alternate File Name field by something the original dev entered

HTH

  • Like 1
Link to post
Share on other sites

I think I figured it out.

This page is considered a "landing page" in this site, so if I load it at domain/mypage it ignores my template. If I load it at domain/landingpages/mypage it DOES load my template. So now I need to figure out how to get it to load my template when the url doesn't have that extra /landingpages/ in the url.

Link to post
Share on other sites

@Brian Peat Just move your new landing page one level up in the page hierarchy. In the page tree, you will see the "Landing pages" page, and below that your new landing page. Move it up to be on the same level as the "Langing pages" page. If that is not possible due to the template's family settings, you can use the Custom Paths module to overwrite the path for your page to whatever you want.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By franciccio-ITALIANO
      Hi everyone.
      I've created 12 templates that are the same but each with an extra bit of html code. 
      The piece of code is as follows:
      <div> <div class="box-pf"> <i class="fa fa-map-pin fa-2x fa-red faa-pulse animated"></i> <a href=""> <span class="uk-text-middle"><i>Sonchus oleraceus</i> 'Grespino degli Orti'</span></b> </a> </div> </div> On the third line we read "fa-red."
      I created 12 similar templates.
      The first template has only one box with fa-red, the last template has 12 boxes with icons of 12 different colors.
      So. is there any way to have only 1 template and add, if I want and when I want, a small or big, same or different piece of html code?
       
    • By rookie
      hi there,
      Is there a module or other solution to select a template with a preview image? Sometimes it is not that easy to describe a template.
      e.g. Template with 3 columns (image, title, content, button) or template for a slider with max. 4 pictures.
      Even if it is nice to have a description field for a template, a picture says more than thousand words could describe.
      And no, I don't think I could develop something like that. I don't even know where to start.🙄
    • By muzzer
      I have just upgraded a site from 2.7 to latest v3.
      I have run into a weird issue where a page template setting for slashUrls changes from No to Yes immediately after an ajax call, causing the second ajax call on the page to use the wrong setting.
      There is no reference to the $template->slashUrls() in any of my code.
      This happens every time I load the page, it's 100% consistent.
      I have this running on a second machine under v2.7 and no such weirdness.
      I'm lost as to why this is happening, what would cause a PW setting change for slashUrls? Anyone have any ideas?
       
       
       
    • By Pip
      Hi everyone, 
      Is there a way for us to replicate the "http://mydomain.com/processwire/page/edit/?id=xxx" and change the template to match my site template? 
      I'm terribly happy with the admin / backend page edit. It covers literaly everything I want to empower my non super admin user in updating pages such as validation, repeater management, file upload. 
      I wish not to allow the users to see the backend for both security and aesthetic reasons. 
      Thanks and hope to hear from you soon. 
       
    • By calago
      after the migration to version 3.0.145 our export templates all of a sudden dont work properly, 
      we have a functionality where we use a boiler template with a set of fields. for some reason since the upgrade when we select the export template to export it. it wont show any of the fields added after the migration, 

      as you can see the offer certificate remarks field has been added to the export, 
      but when we select it it wont come trough

×
×
  • Create New...