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.

Blog Module /

Discuss the Blog Module.

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

[Solved] Template which loads blog entry outside blog module


Go to End


2 Posts   1128 Views

Avatar
borriej

Community Member, 267 Posts

2 March 2011 at 3:30am

Edited: 02/03/2011 3:32am

Hello,

I got the blog module installed.
Now in my pagetree i also have this page 'viewall', this template gets all blogentry's and renders them underneath eachother with the complete story expanded. So visitors who want to view all blog entry's underneath eachother can read it like this.

This works great.

<?php
class ViewAllBlogs extends Page {
	static $db = array(
	);
	
	static $has_one = array(
	);
	static $allowed_children = array();
	
}

class ViewAllBlogs_Controller extends Page_Controller {
	
	function ViewAll($num=9999) {
		$news = DataObject::get_one("BlogHolder");
		return ($news) ? DataObject::get("BlogEntry", "ParentID = $news->ID", "Date DESC", "", $num) : false;
	}

	
}
?>

Now.. my language is set to Dutch in the config.

// Set the site locale
i18n::set_locale('nl_NL');

This works great for the blog, but on the view-all page all the blog sentences (like posted on..) are in English again. On the blog section of my site they do appear in Dutch.

How do i fix this?

template


	<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'op') %> $Date.Long 

Avatar
borriej

Community Member, 267 Posts

3 March 2011 at 11:43pm

create a language file in xoverwrite/lang
and create an empty _config.php file in the dir

nl_NL.php

<?php

global $lang;

//LOGIN
$lang['nl_NL']['Member']['REMEMBERME'] = 'Wachtwoord onthouden?';
$lang['nl_NL']['Member']['BUTTONLOGINOTHER'] = 'Log-uit';

//BLOGS
$lang['nl_NL']['BlogEntry.ss']['POSTEDBY'] = 'Geplaatst door';
$lang['nl_NL']['BlogEntry.ss']['POSTEDON'] = 'op';
$lang['nl_NL']['ViewAllBlogs.ss']['POSTEDBY'] = 'Geplaatst door';
$lang['nl_NL']['ViewAllBlogs.ss']['POSTEDON'] = 'op';
$lang['nl_NL']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Bekijk berichten getagd met';
$lang['nl_NL']['BlogHolder.ss']['VIEWINGPOSTEDIN'] = 'Bekijk berichten geplaatst op';