[solved] User defined tag cause issues after upgrade

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Weon
Forum Members
Forum Members
Posts: 23
Joined: Sun Dec 07, 2008 10:42 am

[solved] User defined tag cause issues after upgrade

Post by Weon »

Hi there

I have just carried out a lengthy upgrade process from 1.9.2 to 1.11.7 and gone through clearing up all the issues. The main one was {stylesheet} to {cms_stylesheet}!

However, I have an issue with a UDT I have set up called child_content_overview that displays the name and start of the content for all child pages of the current page, in a list.

When I try to edit a template that has this UDT in, it causes errors when saving. It looks like exactly the same issue as the stylesheet issue but if I correct the stylesheet reference and remove the {child_content_overview} then the template saves fine.

The UDT itself seems to be working fine and I can edit that no problem so can anyone see a reason why the UDT reference would mean the template wouldn't save?

In case it helps, the UDT code is:

Code: Select all

global $gCms;

$manager =& $gCms->GetHierarchyManager();
$thisPage = $gCms->variables['page_name'];
$currentNode = &$manager->sureGetNodeByAlias($thisPage);

$nodes = $currentNode->getChildren();

if ($currentNode->hasChildren()) {
	foreach ($nodes as $node) {
		$content= $node->getContent();
		if ($content->Active()){
		
			$page_alias = $content->Alias();
			$cgsimple = $smarty->get_template_vars('cgsimple');
			$Sum = $cgsimple->get_page_content($page_alias, 'extra1');
			
			$url = $content->GetURL();
			if ($url == "#") { /* section header has no link by default */
				$url = "index.php?page=".$content->Alias();
			}
			
			echo "<h3><a href=\"".$url."\"  title=\"".$content->TitleAttribute()."\">".$content->MenuText()."</a></h3>\n";
			echo "<p>".$Sum." <a href=\"".$url."\"  title=\"".$content->TitleAttribute()."\">[read more...]</a></p>\n";
			
		}
	}
}
One of the templates it's used in is:

Code: Select all

{process_pagedata}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>{sitename} - {title}</title>
{metadata}
{cms_selflink dir="start" rellink=1}
{cms_selflink dir="prev" rellink=1}
{cms_selflink dir="next" rellink=1}
{* Relational links for interconnections between pages, good for accessibility and Search Engine Optmization *}
{cms_stylesheet}

<!--[if IE]>
{cms_stylesheet name="CCC IE Fix"}
<__script__ type="text/javascript" src="modules/MenuManager/CSSMenu.js"></__script>
<![endif]-->
{* The above JavaScript is required for CSSMenu to work in IE *}

</head>
</__body>
		<div id="pageholder">
			<div id="header">
				<h1><a href="/" title="Return to home page"><span></span>{sitename}</a></h1>
				<div id="phonenumber"><span></span>For appointments or enquiries call 01285 658796</div>
			</div>
			{menu template='CCC Top Menu'}
			<div id="content">
				<div id="sidenavcol" class="columnleft">
					<h4><span></span>In this section</h4>
					{menu template="CCC Side Menu" start_element=$friendly_position|truncate:1:""}
				</div>				
				<div id="pagecopy" class="columnleft">
					<h2>{title}</h2>
					{content}

					{child_content_overview}
				</div>
				
				<div id="fourboxcol" class="columnleft zeromargins">
{global_content name="FourBoxOut"}
				</div>
				<hr />
			</div>
			<div id="footer">
				{global_content name="Footer"}
			</div>
		</div>
	<__body>
</__html>
I'm tearing my hair out because I've been looking through the documentation and I can't see anything wrong.

If anyone can help I would really appreciate it!
Last edited by Weon on Mon Aug 19, 2013 7:53 pm, edited 1 time in total.
Weon
Forum Members
Forum Members
Posts: 23
Joined: Sun Dec 07, 2008 10:42 am

Re: User defined tag cause issues after upgrade

Post by Weon »

To see the UDT in action, take a look at http://cirencesterchiropractic.co.uk/nutrition.html
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: User defined tag cause issues after upgrade

Post by calguy1000 »

Your UDT isnt doing enough error checking and is relying on smarty variables from third party modules that may or may not exist.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: User defined tag cause issues after upgrade

Post by calguy1000 »

Why not just use menumanager.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: User defined tag cause issues after upgrade

Post by Dr.CSS »

Read the what we broke here as there may be calls in your UDT that no longer work is they are and need to be changed...

http://forum.cmsmadesimple.org/viewtopi ... =1&t=57370
Weon
Forum Members
Forum Members
Posts: 23
Joined: Sun Dec 07, 2008 10:42 am

Re: User defined tag cause issues after upgrade

Post by Weon »

Thanks for your help guys.

CalGuy - I have now switched to MenuManager. I'm pretty sure that I tried that route when I first set the site up 5 years ago but at that time I couldn't use MenuManager to display the text stored in Extra1. When I went into MenuManager this time I actually had a menu I had started to set up all that time ago that almost did what I wanted so I can only assume that I abandoned it when it didn't work!

DrCSS - I read through that. Having made the only change I could see was needed it still didn't work!
hexdj
Power Poster
Power Poster
Posts: 415
Joined: Sat Mar 24, 2007 8:28 am

Re: [solved] User defined tag cause issues after upgrade

Post by hexdj »

Could u please post your solution? Thanks.
Weon
Forum Members
Forum Members
Posts: 23
Joined: Sun Dec 07, 2008 10:42 am

Re: [solved] User defined tag cause issues after upgrade

Post by Weon »

Sure. I created a new menu in Menu Manager called CCC Child Overview:

Code: Select all

{if $count > 0}
  {foreach from=$nodelist item=node}
    {if $node->current != true}
      <h3><a href="{$node->url}">{$node->menutext}</a></h3>
      <p>{$node->extra1} <a href="{$node->url}">[Read more...]</a></p>
    {/if}
  {/foreach}
{/if}
I then called it in my template like this:

Code: Select all

{menu template="CCC Child Overview" start_element=$friendly_position number_of_levels="2"}
It's pretty simple and I'm sure it could be a bit cleaner but it works.
hexdj
Power Poster
Power Poster
Posts: 415
Joined: Sat Mar 24, 2007 8:28 am

Re: [solved] User defined tag cause issues after upgrade

Post by hexdj »

Thanks for adding your code!
Weon
Forum Members
Forum Members
Posts: 23
Joined: Sun Dec 07, 2008 10:42 am

Re: [solved] User defined tag cause issues after upgrade

Post by Weon »

No problem, I hope it helped! ;)
Post Reply

Return to “CMSMS Core”