Superfluous - in <title> when $title is empty

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Superfluous - in <title> when $title is empty

Post by cmb » Wed Oct 03, 2012 2:29 pm

Hello Community,

when $title is empty (e.g. as the domain is called without a page name in the query string), the resulting contains a superfluous " - " at the end. I suggest to change function head() in cmsimple/cms.php. Instead of:

Code: Select all

    if (!empty($cf['site']['title'])) {
        $t = htmlspecialchars($cf['site']['title'], ENT_COMPAT, 'UTF-8')
            . " \xe2\x80\x93 " . $title;
    } else {
        $t = $title;
    } 
we might use

Code: Select all

    $t = htmlspecialchars($cf['site']['title'], ENT_COMPAT, 'UTF-8');
    if (!empty($t) && !empty($title)) {
        $t .= " \xe2\x80\x93 ";
    }
    $t .= $title; 
Christoph
Christoph M. Becker – Plugins for CMSimple_XH

oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Re: Superfluous - in <title> when $title is empty

Post by oldnema » Wed Oct 03, 2012 4:43 pm

My opinion (common sense) is that it is the fault site administrator if the name is not specified pages - no need for code modification.
The administrator must only comply with the rules!
Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Superfluous - in <title> when $title is empty

Post by cmb » Wed Oct 03, 2012 4:56 pm

Hi Josef,

I've just checked this issue again, and indeed there is no problem. When the domain is browsed directly (e.g. http://www.example.com) the <title> is as it should be. Only when one is logged in as admin and browses the domain directly, the erroneous <title> is created -- but that doesn't matter, as it's in admin mode only.

So I guess, we can close this case. :)

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1660
Joined: Wed Dec 17, 2008 5:08 pm

Re: Superfluous - in <title> when $title is empty

Post by svasti » Sat Oct 06, 2012 3:42 pm

Why close it so fast? I am just having trouble with a template without title, where in admin mode some empty spaces appear above the navigation. Admin mode should look like normal...
svasti

P.S. Problem solved, but anyhow let'S have an admin mode as wysiwyg as possible.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Superfluous - in <title> when $title is empty

Post by cmb » Sat Oct 06, 2012 4:50 pm

svasti wrote:but anyhow let'S have an admin mode as wysiwyg as possible.
Yes, of course. But the <title> element in the header is never visible on the page -- it is displayed in the title bar of the browser only. And that's a minor issue in admin mode.

However, fixing this particular issue, won't solve the actual problem, which is, that $s is set to late to 0, when the domain is browsed without a page name in the URL. That should better be discussed in http://cmsimpleforum.com/viewtopic.php?f=29&t=5142.
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1660
Joined: Wed Dec 17, 2008 5:08 pm

Re: Superfluous - in <title> when $title is empty

Post by svasti » Wed Oct 17, 2012 12:55 pm

I am just seeing this superfluous "–" in the title of our demo.cmsimple-xh.dk... and wanted to ask to remove it in 1.6

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: Superfluous - in <title> when $title is empty

Post by Gert » Wed Oct 17, 2012 2:07 pm

svasti wrote:I am just seeing this superfluous "–" in the title of our demo.cmsimple-xh.dk
It's just TemplateSwitch_XH (extends the "problem" to the frontend),

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Superfluous - in <title> when $title is empty

Post by cmb » Wed Oct 17, 2012 3:19 pm

Gert wrote:It's just TemplateSwitch_XH (extends the "problem" to the frontend)
Well, I never! The little rascal...

ISTM that CMSimple_XH isn't only amazing, but sometimes quite amusing too.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply