Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » $Author.FirstName only works on homepage?

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: 2034 Views
  • Decisive Flow
    Community Member
    73 Posts

    $Author.FirstName only works on homepage? Link to this post

    I've added $Author.FirstName to the top of each blog post. Ont he homepage, this comes through excellently, on all other page types The name doesn't show and the source shows:

    <a href="" title=""></a>

    I copied and pasted it and can't see anything in hompeage.php that cause this to appear.

  • Sam
    679 Posts

    Re: $Author.FirstName only works on homepage? Link to this post

    I've had a look at your code. The problem is that CoolCompanyIndividual extends SiteTree. This means that it doesn't have an Author field.

    Author field is defined on BlogEntry.

    So, instead you should make CoolCompanyIndividual extends BlogEntry (and CoolCompanyIndividual_Controller extends BlogEntry_Controller).

    This lets you start with BlogEntry as "a base", and build CoolCompanyIndividual on top of that.

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.