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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Tutorial2: stuck in "Adding date and author fields"


Reply


6 Posts   1000 Views

Avatar
speedooo

Community Member, 11 Posts

3 April 2009 at 8:41am

I am following the tutorial 2 today and stuck in this section "Adding date and author fields".
I created these two new fields and rebuild db, I can see them in database.

Then I created new "NEWS" section at the same level as "HOME", and change page type to "ArticalHolder".
After that created new "news Articalpage" under "NEWS", and change the page type to "ArticalPage".

But I did NOT see the new fields Date and Author in this news artical page.

Anything I did wrong, please help?

thanks

kevin

Avatar
speedooo

Community Member, 11 Posts

3 April 2009 at 9:09am

I followed the next step... "Creating the templates"
Created "ArticlePage.ss" and "ArticleHolder.ss" under Layout dir.

I CMS I created news articlepage, I can see them in website, just without Date and author fields.

I went to the database, found new created records in "StieTree" table with my news content, but nothing in "ArticlePage" table???

anything wrong in my process?

thanks

kevin

Avatar
speedooo

Community Member, 11 Posts

3 April 2009 at 1:24pm

fixed.
it's should copy/past " function getCMSFields() {}"
inside class ArticlePage extends Page {}.

Avatar
risingsunset

Community Member, 9 Posts

5 May 2009 at 4:31am

I have the same problem. I pasted the "function getCMSFields() {}" but it still doesn't work...
How knows the CMS to use the new templates? It still uses the "Page.ss"...

Avatar
Aubz

Community Member, 3 Posts

29 October 2012 at 4:54pm

Edited: 29/10/2012 4:55pm

I have the same problem. If I paste the code from ArticlePage.ss that differs from Page.ss ie.
<div class="news-details">
<p>Posted on $Date.Nice by $Author</p>
</div>

into into the template Page.ss the required Date and author data appear in the pages as required. So the data is in the database. The ArticlePage.ss template is however being completely ignored. This is true for the ArticleHolder.ss template as well. The templates are in themes/simple/templates/layout as the tute requires, the code for the ArticleHolder.php and ArticlePage.php ,in mysite/code, as well as the templates is copied and pasted directly from the tute so how the hell can it be ignored? I did note that the class ArticlePage extends Page code in the tute is very poorly written out as there seems to be conflicting versions of the code given. Is this the source of the errors?

Avatar
Aubz

Community Member, 3 Posts

29 October 2012 at 5:08pm

Edited: 29/10/2012 5:08pm

Okay, had a Doh moment, remember after making changes to templates, flush cached crap away. ?flush=1 on the end of any SilverStripe URL will clear out all cached content.