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.

General Questions /

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

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

Admin area title and section


Go to End


640 Views

Avatar
Sultan

Community Member, 8 Posts

5 September 2013 at 1:37am

I have tried to change the setApplicationName in the back end by the following process.
I have a text box in admin area which when filled must take and show as the title in the admin area.
For example in LeftAndMain.ss we have
<title>$title</title>

So when the text box is filled with something $title must take the text box value.
For that what i did is I made a CustomLeftAndMian.php

in that i have written a function

public function CustomTitle(){
$titlefirstpart = CustomLeftAndMain::SuperAdminVals()->Providedby; // this returns the text box value
if(!$titlefirstpart)
$titlefirstpart = "Hubflx";
return ($section = $this->owner->SectionTitle()) ? sprintf('%s - %s', $titlefirstpart, $section) : $app;
}

and I have also overridden LeftAndMain.ss and inside that i have
<title>$CustomTitle</title> ..

Now I get the result as expected, that is i get the value from the text box.

But the problem is on ajax load the value changes and takes what is given in mysite/_config.php in LeftAndMain::setApplicationName('Hubflx');

Again when i refresh the page it takes the text box value.. It does not work on ajax load..
Any suggestions to fix this will be greatly appreciated.. Thanks a lot..