Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Title and Canonical Code Location

edited June 2011 in Vanilla 2.0 - 2.8
Title, Canonical and other Meta is pulled into default.master.php via:

<head> <?php $this->RenderAsset('Head'); ?> </head>

Where is this code exactly?

Thanks, Bryan

Comments

  • lucluc ✭✭
    I guess, many places where stuff is added to the Head asset, "grep Head" in the files to find out.
  • ToddTodd Vanilla Staff
    Controllers have CanonicalUrl() and Title() methods.

    You can start by calling those methods in a plugin or you can do the same thing in your theme hooks.

    Add a function like this:
    public function Base_Render_Before($Sender, $Args) {
    $Sender->Title("Some Title");
    $Sender->CanonicalUrl(parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH));
    }
  • Hey Todd, thanks for the best practice methods.

    For now, I would like to dig into the actual code, this project isn't a concern for me to upgrade.

    I'd really like to modify the actual code if you can point me to where the actual <title></title> code is stored.

    Thanks, Bryan
  • ToddTodd Vanilla Staff
    Most all of the information that is displayed in the head is in /applications/dashboard/modules/class.headmodule.php.

    Here's something you may not know: If you want to modify a class without having to worry about updating the core later you can do the following:

    1. Create a plugin. The plugin itself doesn't have to do anything.
    2. In the plugin's folder copy the current class.headmodule.php.
    3. Modify the file to your heart's content.
    4. Now when you enable the plugin from the dashboard your HeadModule will be used instead of Vanilla's.

    We do this type of thing internally a lot to test out some more drastic changes to core objects.
  • LincLinc Admin
    this project isn't a concern for me to upgrade.
    More famous last words were never spoken.
  • edited June 2011
    this project isn't a concern for me to upgrade.
    More famous last words were never spoken.
    Haha, yeah maybe if it were a client's project. For a personal project where I'm trying to learn some new software down to the nuts and bolts I don't care about getting all medieval on it :).
    Most all of the information that is displayed in the head is in /applications/dashboard/modules/class.headmodule.php.

    Here's something you may not know: If you want to modify a class without having to worry about updating the core later you can do the following:

    1. Create a plugin. The plugin itself doesn't have to do anything.
    2. In the plugin's folder copy the current class.headmodule.php.
    3. Modify the file to your heart's content.
    4. Now when you enable the plugin from the dashboard your HeadModule will be used instead of Vanilla's.

    We do this type of thing internally a lot to test out some more drastic changes to core objects.
    No, I didn't know that was possible. That's downright awesome and I'm loving Vanilla even more.

    Thanks, Bryan
Sign In or Register to comment.