Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.

How to Change Title Seperator from — to |

i want to change the title separator from  —  to |

Tagged:

Comments

  • Sorry for my slowness. You mean the url separator? how-to-change-title-seperator-from-

  • Not url i'm talking about Title Example: How to Integrate PHP with C — Forum Name to How to Integrate PHP with C | Forum Name

  • Ah, yes! That is taken care by the /applications/dashboard/modules/class.headmodule.php

    And the variable is _TitleDivider

    I am unable to inject a change by... maybe somebody else can help with the correct method of doing this injection :)

    class mypPlugin extends Gdn_Plugin {
      public function __construct($sender, $_TitleDivider) {
        $_TitleDivider = ' | ';
        parent::__construct($sender, $_TitleDivider);
      }
    }
    

    But this very nasty hack works like a charm :)

    class myPlugin extends Gdn_Plugin {
      public function base_render_before($sender) {
       $mirrorOnTheWall = new ReflectionClass($sender->Head);
       $property = $mirrorOnTheWall->getProperty('_TitleDivider');
       $property->setAccessible(true);
       $property->setValue($sender->Head, ' | ');
      }
    }
    
  • Okay, it turns out I was over thinking things. It's just a one-liner... hurrah!     $sender->Head->setTitleDivider(' | ');

    And your plugin or theme hook would like this

    class myPlugin extends Gdn_Plugin {
      public function base_render_before($sender) {
       $sender->Head->setTitleDivider(' | ');
      }
    }
    
    R_J
Sign In or Register to comment.