Content - close pages in DIVs?

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
Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Content - close pages in DIVs?

Post by Tata » Thu Aug 25, 2016 3:58 pm

I have found nice tutorials at CSS-Trics for content stylipng. These handle DIVs as separate content-parts containers, however. Could somebody thinkj about this and eventually explain if this would be possible with CMSimple_XH? Could the pages be separated about like this?

Code: Select all

<div (unique id or class)>
	<h1>Page 1</h1>
		{Page 1 content}
</div>
<div (unique id or class)>
	<h1>Page 2</h1>
		{Page 2 content}
		<div (unique id or class)>
			<h2>Page 2-1</h2>
				{Page 2-1 content}
		</div>
		<div (unique id or class)>
			<h2>Page 2-2</h2>
				{Page 2-2 content}
		</div>
</div>
...
If it would b e possible, it might offer many new styling possibilities and constructions.
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: Content - close pages in DIVs?

Post by lck » Sat Aug 27, 2016 6:14 pm

It would be possible via php.

Morepagedata maybe an option.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

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

Re: Content - close pages in DIVs?

Post by Tata » Sat Aug 27, 2016 6:23 pm

I can't imagine good enough how to use Morepagedata for enclosing a page into a DIV and for special styling of this DIV assign id with its unique ID.
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.

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Content - close pages in DIVs?

Post by manu » Sun Aug 28, 2016 9:21 am

Tata wrote:I can't imagine good enough how to use Morepagedata for enclosing a page into a DIV and for special styling of this DIV assign id with its unique ID.
Why not just style the body tag instead of a div and use morepagedata to style the individual page?

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

Re: Content - close pages in DIVs?

Post by cmb » Sun Aug 28, 2016 12:11 pm

Tata wrote:Could the pages be separated about like this?

Code: Select all

<div (unique id or class)>
	<h1>Page 1</h1>
		{Page 1 content}
</div>
<div (unique id or class)>
	<h1>Page 2</h1>
		{Page 2 content}
		<div (unique id or class)>
			<h2>Page 2-1</h2>
				{Page 2-1 content}
		</div>
		<div (unique id or class)>
			<h2>Page 2-2</h2>
				{Page 2-2 content}
		</div>
</div>
...
In my opinion there is no need to store the page structure in content.htm. You could instead customize content(). Basically, you have change both return statements to also output the <div> (maybe <article> would be more appropriate). If you don't want to customize content(), you can alternatively put a copy of it into userfuncs.php, rename it, modify it and call the new function from the template instead of content().

Either way, you have to find a way to set and get the unique ID or class. In the simplest case this could be done by setting a variable on each page via CMSimple scripting, for instance:

Code: Select all

#CMSimple $page_id='page-foo';#
Alternatively, you could use Morepagedata (or a custom addon/plugin) to set this variable.

If the page names won't change (often), you could use these as ID/class by using $su (you'd have to strip/replace some characters, though).

See also Page specific Adjustments and Using own styles for each page for more ideas.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply