Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Content from superclass




21 February 2010 at 1:17am (Last edited: 21 February 2010 4:26am), Community Member, 14 Posts

Hi SilverStripers,

guess i need to describe my site-structur first to make things clear:

control: i have 3 classes called packageA, packageB, packageC which sublass von Package. Package subclasses Page.

view: has the template element $Content while is in layout folder and just inherits from PackagePage making some style changes without using template vars.

In the backend i create one content page for every package (A,B,C) which should be used as content for other pages.

Now i have 6 items which should use packageA, packageB, packageC but need to have different meta-data/different url and different headlines and prices.This makes a total of 18 pages. The different headlines/prices are shown by images inside the template using $URLSegment.

I made a class ItemA which sublusses from PackageA (same for B/C) to re-use it's template code.

ItemAPage_Controller has this method:

   public function PackageAPage(){
    return DataObject::get_one('PackageAPage');
   } uses this template:


Instead of the content for PackageA i get the content of itemA. How can i get the content of PackageA instead?

<EDIT> when i use return DatObject::get_one('Page') i am able to see it's content using the template code from above... This seems like an inherit problem.</EDIT>

<EDIT>ItemA/B/C inherit now from Page. ItemA.SS has now full template of PackageA.SS with minor changes ($ItemA.Content instead of $Content)</EDIT>

But i am still wondering about what caused my problem...

kind Regards