Jump to:

518 Posts in 248 Topics by 261 members

Content Editor Discussions

SilverStripe Forums » Content Editor Discussions » Making content on all pages editing on CMS

Forum for content editors and CMS users.

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

Page: 1 2 3
Go to End
Author Topic: 4644 Views
  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Making content on all pages editing on CMS Link to this post

    When I do get my home page to show up, and save it, it breaks the page. The icon shows a broken icon for the home page.

    When I put your code into the Page.php file, I can get the Global tab to show up and the backend seems to work. But when I put it into a HomePage.php file, I can get the Home Page to show up in Behavior, but the Global tab goes away.

    I also am getting an erro message in Dev mode, that I can;t seem to make go away, even after I put everything back. I think I am making a mess.

    I am slowly understanding your code.

    You want me to put $callHome.SomeFooter into my page footer - Yes?

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Making content on all pages editing on CMS Link to this post

    I have most things working. I had added a few tabs and fields to the Page.php file, and then added them all to the HomePage.php to get the fields on the Home Page.

    I cannot get the Global tab to show up. I can get the Global tab to show on all the Page pages, by adding the code to the Page.php file. But I am guessing I do not need it there sense the Home Page is setting the global value.

    Also, it seems that most of the values are saving with the same variable names in both the Page.php and HomePage.php files. I have one that will not save the value.

    Should the variable - 'SomeFooter' => 'HTMLText' - be called SomeFooter2 on the HomePage.php file, if I have it set to SomeFooter in the Page.php file also?

    I am also able to get the content of the editor to show up on my Home Page, but not on the Page pages.

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Making content on all pages editing on CMS Link to this post

    Ok,

    Erase everything above. I have setup all my files for PageFooter not HomePage. See last several posts.

    I am close, I need help getting the Global tab to show up again...
    I am including my code below that makes up my pages. I hope someone can find where I am missing something here...

    My PageFooter.php file located in the mysite/code folder

    <?php

    class PageFooter extends Page {
       public static $db = array(
       
    'SomeFooter' => 'HTMLText'
       );
       
       static $has_one = array(
       
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root', new TabSet('GlobalContent'));
    $fields->addFieldToTab( 'Root.GlobalContent.FooterContent', new HtmlEditorField('SomeFooter', 'Use the editer below to update your footer content.'));

    return $fields;
    }

    } <<<<<<<<<------------- I had this closing bracket above the function getCMSFields()

    class PageFooter_Controller extends Page_Controller {
       function init() {
          parent::init();
          
          Requirements::themedCSS("layouthome");
          Requirements::themedCSS("typography");
          Requirements::themedCSS("form");
       }
       
       public function callFooter(){
    return DataObject::get_one('PageFooter');
    }
    }

    ?>

    My PageFooter.ss file located in site/templates/Layout

    <div class="typography">
       
          <div id="Content">
          
       $callFooter.SomeFooter
          </div>

    </div>

    My PageFooter.ss file located in site/templates

    footer here (just a blank page with this text)

    All the "Page" pages on my site are showing the "footer here" text.

    I was able as I mentioned before to get the global tab to show up when I add the code SilverRay gave me to use in the Page.php file. But when it is in it's own PageFooter.php file, it does not show up.

    I am so close here. Any ideas are most appreciated.

    Thank you,
    Steve

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Making content on all pages editing on CMS Link to this post

    Ok, getting real close now.

    SilverRay, I could use your help now to place the footer code correctly.

    I have the Global tab now! See post above, I have the bracket in the wrong place. I have corrected it above in case someone wishes to copy the code - it is working now.

    The next part is to get the text I enter into the Root.GlobalContent.FooterContent field to my pages.

    I have removed the FooterPage.ss file from the Layout folder. I don't think I need it.

    I will use the FooterPage.ss file in the templates folder.

    This is what I have inside it.

    <div class="typography">
       $callFooter.SomeFooter
    </div>

    My Page.ss file is calling this page with <% include PageFooter %>

    When I call this $callFooter.SomeFooter from the Page.ss file, nothing happens.

    Any ideas to get this connected and working?

    Thank you,
    Steve

  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: Making content on all pages editing on CMS Link to this post

    1. Put "?flush=1" after the url your loading (in your browser).

    2. Can you paste your code at (for instance) http://pastie.org/ so I can read more easily?

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Making content on all pages editing on CMS Link to this post

    Pastie is nice, but I do not know what to do with the code once generated. They talk about a login, but could not find it.

    I have included my fines here.

    I am running /dev/build/?flush=1 and /?flush=1 with about every change I make to make sure that is not an issue.

    Thank you,
    Steve

    Attached Files
  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: Making content on all pages editing on CMS Link to this post

    Not sure what you mean with Pastie's login.

    Anyway, what I can see is that you have the function callFooter on your PageFooter.php page. That should be actually on Page.php, because you want to use it in all other pages.

    Kind of difficult to see what you've done, because you have a 'Page7.php' file etc... it seems you have an overly complicated file structure. You don't have a homepage template? Conceptually that would make it easy to have global content managed, like footers. If you would follow my code in a separate test setup you can see how it works, then apply it to your existing environment. If you still get stuck, we could PM about it, but it seems we're having a time zone difference...

    HTH

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Making content on all pages editing on CMS Link to this post

    Hi SilverRay,

    I am not sure way SilverStripe named my files with a 6 and 7???

    I will try to do what you are proposing. I cannot talk about the system I am building, but I need to remove as many possible issues as possible. One being the home page being called with the Home Page. I know this will be a continual problem if someone renames it, deletes it, what ever.

    The other thing is that I am only using one level of navigation on the site, but all show in the site map. To remove them from the sitemap, I place a live page under a non-published page, then set my google index to "not indexed" for the sitemap.xml file.

    I also setup a Global navigation link (button) as non-published, and a published link where my global setting are placed. This allows the footer to show the page as published, but not seen in the sitemap.

    Sorry if that is strange, but it is all working in the editor.

    -----------------------

    Ok. Not sure how to PM you. This could be a big project for me if it is excepted. I am running on nickles and dimes right now, otherwise I would just hire someone to help me. I can and will pay you for your help if this is excepted. Just send me your email and I will send money through PayPal - You can find me in google "Steve Nyhof us" - I can send you my skype id as well. Send me your email in my contact form.

    You seem to know what you are doing, and maybe you would have a better understanding of what I am after if we talk.

    --------------------------

    When I moved the code...

    public function callFooter(){
    return DataObject::get_one('Footer');
    }

    to the Page.php file, I receive an error on the front end...

    [User Error] Bad class to singleton() - Footer
    GET /?flush=1

    Line 261 in /home/landingp/public_html/sapphire/core/Core.php

    Thank you,
    Steve

    4644 Views
Page: 1 2 3
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.