Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Infinite request loop with growing page tree in CMS backend after adding a new page type

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

Page: 1
Go to End
Author Topic: 658 Views
  • rrva
    Avatar
    Community Member
    4 Posts

    Infinite request loop with growing page tree in CMS backend after adding a new page type Link to this post

    I am new to silverstripe and just tried to add a new page type which will allow me to fetch content from a remote page.

    So, I added the following to mysite/code/RemoteContentPage.php

    <?php
    class RemoteContentPage extends Page {
    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->replaceField('Content', new TextField('Content', 'URL to Remote Content')); // we abuse the content Field now to save the URL, we could do another DB Field, but since we already have Content ...
    }
    function Content() {
    $Text = 'hejsan paag';
    return $Text;
    }
    }
    class RemoteContentPage_Controller extends Page_Controller {
    }
    ?>

    Then I ran /dev/build?flush=1 and tried to create a new remote content page.

    Here the backend crashed and I received an alert box that something went wrong (what was not visible in any apache log files).

    After that I refreshed the backend by reloading my browser and now the backend page tree menu started to grow indefinitely, adding empty rows to itself and then performing a new request in a infinite loop.

    When I removed RemoteContentPage.php from mysite/code and ran /dev/build again, remoteContentPage was still available in the /dev/build output and the backend crashes in the same way. Logout/Login from the backend did not help either.

    Will clear all cookies and retry. What did I do wrong when trying to add a new page type?

  • rrva
    Avatar
    Community Member
    4 Posts

    Re: Infinite request loop with growing page tree in CMS backend after adding a new page type Link to this post

    The problem was that

    getCMSFields() did not return any value.

    Adding

    return $fields;

    at the end of the function made it all work again.

    658 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.