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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

$Author.FirstName only works on homepage?


Go to End


2 Posts   2808 Views

Avatar
Decisive Flow

Community Member, 73 Posts

10 November 2006 at 1:28pm

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.

Avatar
Sam

Administrator, 690 Posts

10 November 2006 at 2:55pm

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.