Sitename styling

About the template and stylesheet - and changing the menu
Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Sitename styling

Post by Tata » Tue Aug 09, 2016 8:02 am

I want to use e.g. TM, (C) or any other way styled part of a site name. Using the

Code: Select all

SITE NAME <span style='super'>TM</span>
doesn't work. The tags are interpeted like the snadard text SITE NAME <span style='super'>TM</span>. How to override this?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

frase
Posts: 5085
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: Sitename styling

Post by frase » Tue Aug 09, 2016 8:16 am

simple

Code: Select all

SITE NAME <sup>TM</sup>
or CSS

Code: Select all

h1 sup {
	font-size:.8em;
	line-height:2em;
}
HTML

Code: Select all

<h1>SITE NAME <sup>TM</sup></h1>

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Sitename styling

Post by Tata » Tue Aug 09, 2016 9:02 am

Added

Code: Select all

$tx['site']['title']="Site name <sup>XH</sup>";
and

Code: Select all

	.sitename{
		width: 50%;
		float: left;
		font-size: 6vw;
		text-shadow: 0.2vw 0.2vw 0.2vw #aaa;
		}
		.sitename sup{
			font-size: 4vw;
		}
in sylesheet resulted in
Site name <sup>XH</sup>
Writing this hard into the template, it works of course.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

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

Re: Sitename styling

Post by cmb » Tue Aug 09, 2016 9:22 am

The site title will automatically be entity escaped by CMSimple_XH. That is done to avoid potential markup errors. Consider somebody sets the site title to "This & That"; without escaping this would give improper markup (would work, though), so they would have to write "This & That" instead.

The drawback of this approach is that you can't add any markup to the title (there's no way to unescape, or to prevent the escaping). You can, however, echo $tx['site']['title'] in the template directly:

Code: Select all

<h1><?php echo $tx['site']['title']?></h1>
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Sitename styling

Post by Tata » Tue Aug 09, 2016 9:36 am

Thanks, Chris. That's it.

Code: Select all

	.sitename h1{
		width: 50%;
		float: left;
		font-size: 6vw;
		text-shadow: 0.2vw 0.2vw 0.2vw #aaa;
		}
		.sitename h1 sup{
			font-size: 3vw;
			line-height: 6vs;
			vertical-align: top;
		}
and

Code: Select all

                    <div class="sitename">
                      <h1><?php echo $tx['site']['title']?></h1> 
                    </div>
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

frase
Posts: 5085
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: Sitename styling

Post by frase » Tue Aug 09, 2016 11:07 am

Ja,
jetzt habe ich es auch verstanden, dass Tata den Site-Titel aus der CMS-Konfiguration verwenden will.

Bei mir local funktioniert aber noch ein Trick (zumindest mit "TM"):
Das Hochgestellte von woanders direkt kopieren und in der Sprach-Datei (oder in seinem Code) direkt einfügen.
Das funktioniert sogar hier im Forum:

SITE NAME™

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

Re: Sitename styling

Post by cmb » Tue Aug 09, 2016 12:07 pm

frase wrote:Bei mir local funktioniert aber noch ein Trick (zumindest mit "TM"):
Das hochgestellte TM ist ein eigenes Unicode-Zeichen. Ein hochgestelltes XH dürfte es aber nicht geben; vielleicht sollten wir das als Vorschlag einreichen. (Nicht wirklich ernst gemeint!)

Was aber denkbar wäre, wäre eine spezielle Font; dann ließe sich mit CSS3 vermutlich was machen. Wäre aber wohl Overkill.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Sitename styling

Post by Tata » Tue Aug 09, 2016 9:26 pm

cmb wrote:Ein hochgestelltes XH dürfte es aber nicht geben
Selbstverständlich wurde das "XH" nur als Design Element gemeint.
Es ist auch als "&#8482; &trade; &#x2122;" möglich. Auf der Seite habe ich es aber

Code: Select all

<h1><?php echo $tx['site']['title']?></h1>
und

Code: Select all

	.sitename h1{
		font-size: 6vw;
		}
		.sitename h1 sup{
			font-size: 3vw;
			line-height: 6vs;
			vertical-align: top;
		}
gemacht.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

lck
Posts: 2963
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Sitename styling

Post by lck » Wed Aug 10, 2016 4:36 pm

Warum verwendet man für die Ausgabe des Seitentitels imTemplate nicht

Code: Select all

<h1><?php echo sitename()?></h1>
sondern stattdessen

Code: Select all

<h1><?php echo $tx['site']['title']?></h1>
das ergibt doch das Gleiche, oder irre ich da?

Ob so oder so, könnte man dann folgendes machen um z.B. einen Seitentitel "CMSimple" mit höhergestelltem "XH" zu erzeugen:
(Beispiel-Template hierfür ist mini1)

Unter Einstellungen > Sprach-Datei > Seitentitel in der Browseranzeige
eintragen: CMSimple

in der template.htm

Code: Select all

<div class="sitetitle"><h1><?php echo $tx['site']['title']?></h1></div>
<!-- oder ? -->
<div class="sitetitle"><h1><?php echo sitename()?></h1></div>
in der stylesheet.css

Code: Select all

.header h1:after, .sitetitle h1:after {
    content: " XH";
    font-size: 50%;
    vertical-align: top; /* (vertical-align: supper; oder vertical-align: ..px; */
}
Resultat ist ein Seitentitel "CMSimple" mit höhergestelltem "XH" im Header und in der Seite.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

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

Re: Sitename styling

Post by cmb » Wed Aug 10, 2016 7:31 pm

lck wrote:das ergibt doch das Gleiche, oder irre ich da?
Es ergibt das gleiche, solange keine besonderen HTML-Zeichen (<, >, &, ") im Titel enthalten sind – diese werden nämlich von sitename() in HTML-Entities (<, >, &, ") umgewandelt, was normalerweise wohl auch so gewünscht wird, aber eben kein Markup erlaubt.

Der CSS-"Trick" ist sehr nett! Danke! :)
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply