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

Admin area title and section


Reply

175 Views

Avatar
Sultan

5 September 2013 at 1:37am Community Member, 8 Posts

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..