+ Reply to Thread
Results 1 to 5 of 5

Thread: Page Title Help Needed

  1. #1
    rcmmm is offline Registered User
    Join Date
    Jun 2007
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Page Title Help Needed

    Hi all,
    I am new to RC, and have to say I LOVE it. I am trying to alter a few things and the one I am currently stuck on is showing the email of a user in the title, so the title would be john@doe-Roundcube Webmail . Does anyone know how I could do this please? Any help would be greatly appreciated. Thanks!

  2. #2
    windhood is offline Registered User
    Join Date
    Jul 2007
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: Page Title Help Needed

    Hi,did you get this resolved?
    it is really weird, php code does not have effect in the template files (under skins/default/include or template)

  3. #3
    rcmmm is offline Registered User
    Join Date
    Jun 2007
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Re: Page Title Help Needed

    Hi,
    There may be a better way of doing it but I did it like this:

    1. Find the big switch statement in program\include\rcmail_template.inc
    2. Scroll thoruhg that switch statemtn untuil line 448, where you will hit this code:
    else if ($object=='pagetitle')
    {
    $task = $this->task;
    $title = !empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '';

    if (!empty($this->pagetitle))
    $title .= $this->pagetitle;
    else if ($task == 'login')
    $title = rcube_label(array('name' => 'welcome', 'vars' => array('product' => $this->config['product_name'])));
    else
    $title .= ucfirst($task);

    return Q($title);
    }

    3. I simply replaced this with this:
    else if ($object=='pagetitle')
    {
    $task = $this->task;
    if ($task == 'login'){
    $title = rcube_label(array('name' => 'welcome', 'vars' => array('product' => $this->config['product_name'])));
    }
    else{
    $emailaddy=$_SESSION['username'];
    $title=$emailaddy1." - Roundcube Webmail";
    }
    return Q($title);
    }

    Hope that helps. Cheers!

  4. #4
    bobmagoo is offline Registered User
    Join Date
    Jul 2009
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default slight tweaking

    I realize I'm replying to an older thread, but hopefully a few of you will find this useful.

    Based on rcmmm's code but with a few tweaks, here's what I came up with.

    PHP Code:
    if ($task == 'login'){
                        
    $title rcube_label(array('name' => 'welcome''vars' => array('product' => $this->config['product_name'])));
                        }
                        else {
                            
    $titleP1 "";
                            if (isset(
    $_SESSION['username'])) {
                                
    $titleP1 $_SESSION['username'];
                            } else {
                                
    $titleP1 "Roundcube";
                            }
                            
    $title $titleP1 " - Webmail";
                        }
                        return 
    Q($title); 
    This takes the currently logged in user's name and sets it as the title, adding a "- Webmail", and if no user is logged in, it sets the title to Roundcube - Webmail.

    My php skills are fairly limited, so any suggestions for improvement would be appreciated. I think this idea would be something worth adding to the next release.
    Last edited by bobmagoo; 07-11-2009 at 12:59 AM.

  5. #5
    PeterHaartsen is offline Roundcube Newcomer
    Join Date
    Feb 2010
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default

    I made a modification similar to the one showed by rcmmm to get the username in the title. I use Roundcube 0.3.1.

    I added one line to program/include/rcube_template.php (see highlighted part):

    /**
    * Getter for the current page title
    *
    * @return string The page title
    */
    public function get_pagetitle()
    {
    if (!empty($this->pagetitle)) {
    $title = $this->pagetitle;
    }
    else if ($this->env['task'] == 'login') {
    $title = rcube_label(array('name' => 'welcome', 'vars' => array('product' => $this->config['product_name'])));
    }
    else {
    $title = ucfirst($this->env['task']);
    }

    $title.=" :: ".$_SESSION['username'];

    return $title;
    }

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts