Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Layouts/ArticleHolder.ss not being used

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1667 Views
  • sarahk
    Avatar
    Community Member
    46 Posts

    Layouts/ArticleHolder.ss not being used Link to this post

    Not sure what I've done here but ArticlePage.ss is being used, however ArticleHolder.ss isn't.

    I've just uploaded that new release (http://www.silverstripe.com/general-discussion/flat/735#post735), I've flushed the cache and the db. No typos etc.

    The controller looks fine in the back end, extra fields, icons etc

    Any ideas?

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Layouts/ArticleHolder.ss not being used Link to this post

    Perhaps posting some code may shed some light?

    You could also try adding ?flush=1 to the end of the URL, if you haven't already done so, to ensure SilverStripe is looking for the template when before it may not have been.

    Cheers!

    Sean

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Layouts/ArticleHolder.ss not being used Link to this post

    Another one is to add ?showtemplate=1 to the end of the URL (when on a page which uses ArticleHolder in question), you'll get a bunch of debugging information at the top of the page.

    It should show something like this or similar, which is the heirachy of classes for your 'pages':

    2 = ArticleHolder
    1 = Page
    0 = SiteTree

    If ArticleHolder doesn't show up then it's not able to find the template, or the page type hasn't been applied to the page.

    Cheers,
    Sean

  • sarahk
    Avatar
    Community Member
    46 Posts

    Re: Layouts/ArticleHolder.ss not being used Link to this post

    Thanks Sean

    I was working through the tutorials and I'd skipped through the Article option and then realised that the ArticlePage was customised but not the Holder.

    I've put a debugging email in and it's not being sent. I put it in the same place in ArticlePage and it worked. In admin I can see that the page is set up right, has the icon, is published so I'm halfway there

    <?php
    /**
    * Defines the ArticleHolder page type
    */
    class ArticleHolder extends Page {
    static $db = array( );
    static $has_one = array( );

    static $allowed_children = array('ArticlePage');
    static $icon = "mysite/images/treeicons/news";
    }

    class ArticleHolder_Controller extends Page_Controller {
          
       function index() {
          $e = new Email("myemail@gmail.com", "myemail@gmail.com", "in Article Holder", "test");
          $e->send();      
       }
    }
    ?>

    BTW, ?showtemplate=1 didn't seem to do anything but would be a great debugging tool.

    1667 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.