Page 1 of 1

new LAYOUT for full article display

Posted: Mon 24. Jul 2006, 08:32
by jsw_nz
Up to now Olig had offered the option to control

Artilcle Summary Listings
AND
Full Article Summaries

using his template scheme...

Having spent some time with Wordpress been noticing a nice feature -- Basically a sniffer:

Code: Select all

if (page_single) {
then do this
}
psuedo code

In effect Wordpress allows showing a full blog article in a new layout
In Wcms terms >>>> showing the article summary AND contentparts in a new layout without menu (or other design)
effectively getting rid of the column menu(left/right) paradigm.

Was thinking about this for wcms in a css context ...
and one thought came to mind.

Wcms can sniff for:
GLOBALS['content']['article_id']
if it exists - then we BASICALLY KNOW we are on a single full article display setting....
UPDATE:
$GLOBALS['content']["article_list_count"]
is a better criteria - see further posting --

So the thought came to mind

if using custom template - option 3 (1-tables) (2-OliG CSS) (3-custom template defined in main section)
then a sniffer could be created to send the script to another css/based layout template....
been thinking about this for the last couple of days...
so wanted to ask if any have already explored this...
and if so if they might have urls...
have to believe this has been done already

Just thinking out loud
:D :D

Posted: Mon 24. Jul 2006, 10:24
by kubens
If you could use replacement tags inside "html head" this would be very nice and simple to realize. But unfortunatelly this is not possible :-( However you can use [PHP] ... [/PHP] and this is almost nice and simple ;-)

html head

Code: Select all

<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="robots" content="index,follow">
<meta name="language" content="deutsch, de">
<meta name="distribution" content="global">
<meta name="robots" content="all">
<script type="text/javascript" language="JavaScript" src="/site.js/lib.js"></script> 
<script type="text/javascript" language="JavaScript" src="/site.js/prototype.js"></script> 
[PHP] echo wakGetCSS(); [/PHP]
Br
Wolfgang

Posted: Mon 24. Jul 2006, 11:22
by jsw_nz
Hi Kubens,

Good points...

I am guessing that the

Code: Select all

[PHP] if (......) { [/PHP] 

....css listings layout code....

[PHP] }else{ [/PHP]

....css full article layout code....

[PHP] } [/PHP]


cannot properly be parsed using custom layout option...
at least in the way that {PHP} can


....that does not rule out further approaches - will look into this tomorrow.

Kind Regards Kubens for your contributions,
maybe you have a brainstorm idea :!:

cheers,
:D :D

Posted: Mon 24. Jul 2006, 22:59
by jsw_nz
This seems to work - since splitting into 2 parts using css is easier:
only requirement is to create empty stub article - in cases where only single article will show in a given category - giving a total of two articles

the stub article: no title display - exclude search - empty summary - empty template applied to it - if necessary

This is to ensure article count is > 1 in every category...since
$GLOBALS['content']['article_id'] is not set in listing mode
(there may be another way to solve this issue:

Code: Select all

[PHP] 
if (!isset($GLOBALS['content']['article_id'])){
include("css_layout_before_1.php");
}else{
include("css_layout_before_2.php");} 
[/PHP] 
<div id="content">
{CONTENT}
</div>
[PHP] 
if (!isset($GLOBALS['content']['article_id'])){
include("css_layout_after_1.php");
}else{
include("css_layout_after_2.php");} 
[/PHP]
i know this is a hack,
but works for current project...
:D :D

Posted: Tue 25. Jul 2006, 04:07
by jsw_nz
again there may be other approaches that OliG has in mind
- this is a 'just-in-time solution' atm

Posted: Wed 26. Jul 2006, 11:02
by phalancs
hey, this is already inside phpwcms. From the first day on...

Check the printer thing. Call "printer" link "article only" link and it should be pretty much it. ;)

Posted: Wed 26. Jul 2006, 11:49
by jsw_nz
Hi phalancs,

sort of follow what you say - my justification is to create brand new layout(s) of articles in full display (not as listing) - with opportunity to call mutliple css layout schemes - ie multiple layout 'contaners' - -if you are pointing me in the right direction - i am all ears - in the meantime this scheme is working

Posted: Wed 26. Jul 2006, 13:28
by kubens
By the way, if you are interested to replace the complete layout then you should spent some minutes in this variable $GLOBALS['block']. If you modify this variable from frontend_init then you will get absolutly felixibility if you want to render different layouts based on special criteria:

phpwcms_template/inc_script/frontend_init/wak.domain.pagelayout.php

Code: Select all

<?php 

switch (wakGetDomain())  {
  case DOMAIN_A:
    $GLOBALS['block']['maintext']='<hr>A<hr>{CONTENT}';
    break;
  case DOMAIN_B:
    $GLOBALS['block']['maintext']='<hr>B<hr>{CONTENT}';
    break;
  default:
    $GLOBALS['block']['maintext']='<hr>DEFAULT<hr>{CONTENT}';
}

?>
Br
Wolfgang

Posted: Thu 27. Jul 2006, 00:47
by jsw_nz
Hi Wolfgang,

Interesting point - that switcher wakGetDomain()...
Is that creation of yours documented somewhere?

I did try to plug my script into frontend_init:

Code: Select all

if (....my conditional.....){
	ob_start();
	include("my_include_before.php");
	$before = ob_get_contents();
	ob_end_clean();
	ob_start();
	include("my_include_after.php");
	$after = ob_get_contents();
	ob_end_clean();
	$GLOBALS['block']['maintext'] = $before.'{CONTENT}'.$after;
}
in principle it works, however the specific artcle_id sniffer is not available at this stage, since it is determined after first rendering process.

But yes this is nice to know...
certainly $_SESSION, $_GET, $_POST and other HTTP stuff is available.

Looking at content.func.inc.php, am finding that:

Code: Select all

$GLOBALS['content']['article_id']
is sniffable - so that might be a place extra stuff.
In fact the entire logic and framework of page rendering could be controlled there -
sort of in a stealth way.

Cheers,
John :D

Posted: Tue 1. Aug 2006, 13:16
by jsw_nz
Seems that the conditional to switch page layouts between listing and full article mode would be better determined by:

Code: Select all

$GLOBALS['content']["article_list_count"]
since it exists when wcms is called to list articles, regardless of count.

Code: Select all

[PHP]
if ($GLOBALS['content']["article_list_count"]){
include("css_layout_before_1.php");
}else{
include("css_layout_before_2.php");}
[/PHP]
<div id="content">
{CONTENT}
</div>
[PHP]
if ($GLOBALS['content']["article_list_count"]){
include("css_layout_after_1.php");
}else{
include("css_layout_after_2.php");}
[/PHP]

suggests new possibilities to swap full page layout templates

:D

Posted: Thu 17. May 2007, 18:32
by jsw_nz
UPDATE

i am using this code for custom css main block;

Code: Select all

case 2: //create the page layout based only on the content of main block
				//$content["all"]	= $block["maintext"];//
				// break;
				// modified jsw_nz
				$int_val_count = intval($GLOBALS['content']["article_list_count"]);
				global $article_listmode;
				if ($int_val_count > 1){
					// show listing only
					$article_listmode = 1;
					$content["all"] .= $block["headertext"];
				}else{
					// show full article
					$article_listmode = 0;
					$content["all"] .= $block["maintext"];
				}
				//$content["all"] .= $block["footertext"];
				break;
is working and allows two separate templates - one for listing and one for full article