Multiple template preview not working properly?

Use GitHub to post bug reports and error descriptions for phpwcms. Describe your problem detailed!
Locked
Shrike71
Posts: 14
Joined: Fri 28. Nov 2003, 16:26

Multiple template preview not working properly?

Post by Shrike71 »

:?:
Hi All,

I was wondering if anyone else encountered this problem.

I have a site with one template (template_a) set as default at the index (website start level). I have created a different template (template_b) which i have set to a sublevel of the site.

The problem is this:

When i view a page in the sublevel (template_b) by clicking on the page link from the "sitestructure and article list" i see the page, but with the default template (template_a) applied, so any pages under the sublevel are previewed with template_a. However, in the REAL site, i.e. if i go and browse the site myself, the pages in the sub level (template_b) work properly. Switching off the default behaviour doesn't seem to make any difference.

As a case in point, the URL when browsing the page from the "sitestructure and article list" looks like this:

http://localhost/test/index.php?id=0,6,0,0,1,0

but when i try a REAL browse it looks like this:

http://localhost/test/index.php?id=2,6,0,0,1,0

It looks like the phpWCMS backend isn't taking into consideration any "sublevel" splitting... am i doing something wrong?

Thanks & regards,

Shrike71

PS. I think the whole application is fantastic, maybe a little simple for most enterprise CMS requirements, but for small intranet / website applications you just can't help but feel that phpWCMS is "just right". Well done, Oliver! :wink:
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

There is a problem with categories that I will fix next.

Use the alias function instead and if possible index.php?my_level_alias.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

OK I fixed that problem (I think). 3 lines of code has to be changed:

front.func.inc.php around line 479:

Code: Select all

function get_actcat_articles_data ($act_cat_id, $dbcon) {
	//returns the complete active and public article data as array (basic infos only)
	//so it is reusable by many functions -> lower db access
	
	$sql  = "SELECT *, UNIX_TIMESTAMP(article_tstamp) AS article_date FROM ".DB_PREPEND."phpwcms_article ";
	$sql .= "WHERE article_cid=".intval($act_cat_id)." AND article_public=1 AND article_aktiv=1 AND article_deleted=0 ";
	$sql .= "AND article_begin<NOW() AND article_end>NOW() ";

	// CHANGE HERE !!!!!!!
	//$sql .= "ORDER BY article_cid, article_sort, article_tstamp DESC;"; // DONT FORGET TO COMMENT THIS LINE!
	$sql .= "ORDER BY article_sort;"; // <- THIS IS NEW


	
	if($result = mysql_query($sql, $dbcon)) {
		while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
			$data[$row["article_id"]] = array(
									"article_id"		=> $row["article_id"],
									"article_cid"		=> $row["article_cid"],
									"article_title"		=> $row["article_title"],
									"article_subtitle"	=> $row["article_subtitle"],
									"article_keyword"	=> $row["article_keyword"],
									"article_summary"	=> $row["article_summary"],
									"article_redirect"	=> $row["article_redirect_to"],
									"article_date"		=> $row["article_date"],
									"article_username"	=> $row["article_username"],
									"article_sort"		=> $row["article_sort"] );
		}
		mysql_free_result($result);
	}
	return (sizeof($data)) ? $data : array();
}
and around line 654:

Code: Select all

function list_articles_summary ($article_list, $template_default, $cat_id=0, $link_to="index.php") {
	// returns an article listing only with headline and summary text
	// and with an listing of all other available articles of this category
	
	$listing = $template_default["space_top"]; //start with space at top
	
	$temp_counter = 0;
	foreach($article_list as $key => $value) {
		
		//$article_link  = $link_to."?id=".$cat_id.",".$article_list[$key]["article_id"].",0,0,1,0";
		$article_link  = $link_to."?id=".$article_list[$key]["article_cid"].",".$article_list[$key]["article_id"].",0,0,1,0";

//and so on.
And to make also the backend article link well formatted change in admin.functions.inc.php line 83:

Code: Select all

			$a .= "<td class=\"dir\"><a href=\"index.php?id=".$article[$akey]["article_cid"].",".$article[$akey]["article_id"];
There was id=0,...

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
AlleyKat
Posts: 41
Joined: Thu 4. Dec 2003, 13:08
Contact:

Post by AlleyKat »

:D this also makes the {author}-tag show up in 'preview'. Cool.
Locked