ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Updated to 1.6...can't find where to hide templates

June 21, 2007 1:04pm

Subscribe [4]
  • #1 / Jun 21, 2007 1:04pm

    Deron Sizemore

    1033 posts

    I love the idea of being able to hide templates so that visitors cannot accidentally access templates meant to be embedded, but in my searching, I cannot find where to hide them.  I would have thought it would be right out in the open?

  • #2 / Jun 21, 2007 1:21pm

    Sue Crocker

    26054 posts

    Deron…

    Hiding Templates

    ExpressionEngine uses a convention that is common among many file-systems, so it may already be familiar to you. To make a template “hidden”, simply give it a name preceded by a period, e.g. “.my_hidden_template”.

    Make sense?

    EEDocs:// Hidden Templates

  • #3 / Jun 21, 2007 1:32pm

    Deron Sizemore

    1033 posts

    I didn’t manually look under the “template system” in the docs.  I did a search for “hidden templates” and nothing popped up (I guess google hasn’t indexed it yet). 

    Yep, makes sense.  It works a little differently than I thought though.  For example I have an “includes” template group a and inside that group I have an “index” template that I’m not doing anything with as the naming convention of “index” didn’t suit the purpose (I wanted to use “header,” “footer,” etc.) so I assumed with this new hidden template function, I would be able to go in and click the ‘hide’ button on the “index” template in that “includes” group.  This way wont work since the index is there by default and cannot be edited. Still a step up from where it was.  Hiding the ones I can is a big help.

    ———————————————————————

    EDIT: OK, not sure it’s working as it should be?  I went into the ” template preferences” for my “includes” template group and changed the template name “footer” to “.footer”

    It doesn’t take me to my 404 Error page which I’ve specified in the Global Template Preferences when I try to access My Footer Embed.  I simply get a blank page.  Now, if I try to access http://www.randomjabber.com/includes/.footer then I get my 404 error, but who would mistakenly type in a URL with a period in front of the template name?

  • #4 / Jun 22, 2007 9:33am

    Deron Sizemore

    1033 posts

    Bumping this back up to the front page. 

    Still having some problems with this.  The only thing I can figure it that the feature it working as it should, but I’m interpreting it to work another way?  😊

  • #5 / Jun 22, 2007 11:17am

    Derek Allard

    3168 posts

    Well, it sounds like you’ve got 2 templates?  1 called “footer” and 1 called “.footer”.  Is this correct?  If so, the idea behind hidden templates is that you’d delete footer and only use .footer for embeds.  Make sense?

    So my suggestion would be to change all embed references of “footer” to “.footer”, and then remove it.

  • #6 / Jun 22, 2007 12:32pm

    Deron Sizemore

    1033 posts

    Hi Derek,

    Let me start from square one. I evidently caused some confusion with my earlier explanations of what I actually had going on in my templates. 

    I have a template group called “includes” which originally (before the upgrade) contained the template called “footer.” 

    After the upgrade, I went into the “includes” template group and changed the “footer” template name to “.footer”  So, now after the rename, I only have one template for the footer embed and it is called “.footer”

    On my page templates in which I embed the footer, I changed the embed references to “.footer”

    So, with that said, if I try to access the footer embed template, I should get a 404 error page (which I do):  http://www.randomjabber.com/includes/.footer

    But if I try to access http://www.randomjabber.com/includes/footer, I simply get a blank page (rather than a 404 error page like I would expect)

    I guess it’s working right, as when I try to access that embed template by going to “.../includes/.footer” I get the 404 error page, but I can’t think if any reason that it would even cross a visitor’s mind to try and access a URL with a period in front.  However, I can see someone trying to access the URL without the period, and it simply gives you a blank white page.  I thought if the template didn’t exist a 404 error would come up?

    Does that make more sense as to what I’m asking? Sorry I know what I want to say, just can’t spit the words out.  😊

  • #7 / Jun 22, 2007 1:01pm

    Derek Allard

    3168 posts

    Gotcha.

    Here are several pages that give blanks

    http://www.randomjabber.com/includes/footer
    http://www.randomjabber.com/includes/fakepage
    http://www.randomjabber.com/includes/asdf

    What I believe is happening is that those templates don’t exist, so it goes to the default for the template group “includes”, which I’m betting is a blank page, or non-existent.  At any rate, its fine behaviour, and won’t impact on the day to day running or randomjabber.

  • #8 / Jun 22, 2007 1:07pm

    Lisa Wess

    20502 posts

    If you don’t want those blank,  you can put some content into the includes index page.  Or if you’re really clever, you can set the index page to be not viewable by anyone and to redirect when viewed by someone without access (now everyone) to your 404 template.  Check this out:

    http://lisajill.net/bits/adfljaf

    You’ll have to test this kind of thing not logged in.  It won’t generate a real 404 header though, since you’re just doing a straight redirect to that template.  In thinking about this, perhaps a template type for “404” would be good to circumvent problems like this.  You could probably use PHP to set the response header on the template, but I don’t know how to do that myself. =)

  • #9 / Jun 22, 2007 1:23pm

    Daniel Walton

    553 posts

    <?php
        header("HTTP/1.0 404 Not Found");
    ?>
  • #10 / Jun 22, 2007 1:30pm

    Lisa Wess

    20502 posts

    Thanks, the_butcher. =)  I found something similar on google but it had a syntax error and so I gave up to get work done =)

  • #11 / Jun 22, 2007 1:58pm

    Derek Jones

    7561 posts

    Something like this in your includes/index template should do the trick (PHP parsing enabled, of course)

    <?php
    header("Status: 404 Not Found");
    echo "Status: 404 Not Found";
    exit;
    ?>

    EDIT: Attack of the non-refreshed window strikes Derek again!  (Shut up, Lisa!)

  • #12 / Jun 22, 2007 2:29pm

    Lisa Wess

    20502 posts

    I didn’t say a thing, really. =)

  • #13 / Jun 22, 2007 3:04pm

    Deron Sizemore

    1033 posts

    Hey everyone, thanks for your patience with me on this.  I’ve got it sorted out now.  I guess what was confusing the heck of me was not realizing that when I went to .../includes/footer (and got the blank page) that it was redirecting me to the index template under “includes” (which as you guessed Derek, is blank). 

    If you don’t want those blank,  you can put some content into the includes index page.  Or if you’re really clever, you can set the index page to be not viewable by anyone and to redirect when viewed by someone without access (now everyone) to your 404 template.

    I went with this suggestion, but I went about a little different way.  It seems easier (and more clever?) With my new knowledge that it was simply redirecting me to the “index” page of that template group, all I did was copy and paste the contents of my “404-Error” template, into the “index” template of the “includes” template group and voila, I have a 404 Error when people try to access at template that doesn’t exist in the “includes” template group.  No redirects and no PHP (since I’m PHP illiterate)

  • #14 / Jun 22, 2007 3:06pm

    Derek Jones

    7561 posts

    Well, it may look like your 404 page, but if it’s not sending 404 headers, then it will not be served as such, which could get you into some duplicate content issues with search engines.

  • #15 / Jun 22, 2007 3:26pm

    Deron Sizemore

    1033 posts

    Ah, that’s a good point. 

    So, if I go in like Lisa said and deny access to everyone and redirect anyone trying to access that template to the 404 error template, where do I need to place this at:

    <?php
    header("Status: 404 Not Found");
    echo "Status: 404 Not Found";
    exit;
    ?>

    Just inside of the blank index template?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases