$content is breaking search result page / blank searchresult

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
mikes84
New Member
New Member
Posts: 5
Joined: Tue Apr 09, 2019 11:45 am

$content is breaking search result page / blank searchresult

Post by mikes84 »

Hi,
I am managing a 1.12.1 install of CMSmadeSimple which I inherited. I did not set up the site and try to figure it out step-by-step.

CASE
Recently I used Rolfs automated metatags tutorial and now the page with search results is blank. I have some clue where the problem is but I can't seem to fix it myself.

DETAILS
I used this tutorial about automated metatags. As part of this I inserted

Code: Select all

{$content = "{content}" scope=global}
in the top of my template code. Now the search result page only loads part of the source code and only shows a blank page. When I comment this line out, search results are back. But then automated metatags don't work in the news module. I would like both to work. How do I make this work? Thanks for reading along!

The site is at https://www.somtuniversity.nl
A blank search result is here: https://www.somtuniversity.nl/zoeken/?m ... eturnid=27

The source code of the blank page ends with

Code: Select all

<div class="page_zoeken">
<!-- END tpl_open -->




Below I have attached:
  • system info
  • template
  • 2 relevant HTML blobs
system information
Cms Version: 1.12.1

Installed Modules:

CMSMailer: 5.2.14
CMSPrinting: 1.0.5
FileManager: 1.4.5
MenuManager: 1.8.7
CGSimpleSmarty: 1.6.2
ModuleManager: 1.5.8
News: 2.15.2
Search: 1.7.13
ThemeManager: 1.1.8
TinyMCE: 2.9.12
FormBuilder: 0.8.1.6
FormBrowser: 0.5
Gallery: 2.3.2
CGExtensions: 1.38.1
Statistics: 1.2.1.2
babel: 0.4.1
AceEditor: 1.0
ListIt2: 1.4.1
ListIt2Slideshow: 1.4.1
ListIt2Gallery: 1.4.1
AdvancedContent: 0.9.4.3
ListIt2Video: 1.4.1
ListIt2FAQ: 1.4.1
ListIt2Studie: 1.4.1
SiteMapMadeSimple: 1.2.7
MicroTiny: 1.2.9
JMFilePicker: 1.0.1

Config Information:

php_memory_limit:
process_whole_template:
max_upload_size: 32000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:

phpversion: 5.3.28
md5_function: Aan (Waar)
gd_version: 2
tempnam_function: Aan (Waar)
magic_quotes_runtime: Uit (Onwaar)
E_STRICT: 0
E_DEPRECATED: 0
memory_limit: 512M
max_execution_time: 30
output_buffering: 4096
safe_mode: Uit (Onwaar)
file_uploads: Aan (Waar)
post_max_size: 8M
upload_max_filesize: 32M
session_save_path: /tmp (1777)
session_use_cookies: Aan (Waar)
xml_function: Aan (Waar)
xmlreader_class: Aan (Waar)

Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.31
Server Db Grants: Er is een "GRAND ALL" permissie gevonden, alles lijkt in orde.
Server Time Diff: Geen tijdverschil aangetroffen
Template

Code: Select all

{process_pagedata}

{global_content name='tpl_open'}

{content_module block_group="Header" module="JMFilePicker" mode="browser" dir="images/" label="Header image" block="headerBg" assign="headerBg"}
{if empty($headerBg)}{assign var="headerBg" value="images/site/header/followpage_header.png"}{/if}
{content_module block_group="Header" module="JMFilePicker" mode="browser" dir="images/" label="Header image retina (2x)" block="headerBg2x" assign="headerBg2x"}
{if empty($headerBg)}{assign var="headerBg2x" value="images/site/header/followpage_header_2x.png"}{/if}

{content label="Page content" assign="content"}
{content block_group="Sidebar" block_type="checkbox" label="Hide sidebar?" block="sidebarCheck" assign="sidebarCheck"}
{content block_group="Sidebar" block_type="checkbox" label="Hide subscription?" block="subscription" assign="subscription"}
{content block_group="Sidebar" block_type="checkbox" label="Hide extra?" block="extra" assign="extra"}
{content block_group="Sidebar" label="Sidebar content" block="directions" assign="directions"}
<div class="tpl_vervolg">
    <div name="header" id="header" style="
        {literal}
            background-image:url('{/literal}{uploads_url}/{$headerBg}{literal}');
            @media only screen (-webkit-min-device-pixel-ratio: 2) and (min-resolution: 192dppx){background-image:url('{/literal}{uploads_url}/{$headerBg2x}{literal}');}
        {/literal}
    ">
        {global_content name='tpl_header'}

        <div class="links container">
            <div class="title">
                <h1>
                    {level}
                    {cgsimple::get_parent_alias() assign='parent'}
                    {if $level == 2}
                        {menu_text}
                        {capture assign='submenu'}{menu childrenof=$page_alias number_of_levels=1}{/capture}
                    {elseif $level > 2}
                        {cgsimple::get_page_title($parent) assign="parent_title"}
                        <!--3{$parent_title}4-->
                        {menu_text}
                        {capture assign='submenu'}{menu childrenof=$page_alias number_of_levels=1}{/capture}
                    {else}
                    {capture assign='submenu'}{menu childrenof=$page_alias number_of_levels=1}{/capture}
                        {menu_text}
                    {/if}
                </h1>
            </div>
        </div>
    </div>
    

    {if !$parent}                    
        {$page_alias assign='parent'}
        {menu_text assign='page_title'}
    {else}
        {cgsimple::get_page_title($parent) assign='page_title'}
    {/if}
    
 


    <div class="content {if !empty($sidebarCheck)}fullscreen{/if}">
        <div class="container">
            <div class="pageLeft clearfix">
                <div class="kruimelpad"><a href="{root_url}">Home</a> {fa icon='fa-chevron-right'} {breadcrumbs delimiter=" {fa icon='fa-chevron-right'} "}</div>
                {if !empty($submenu)}
                    <div class="submenu">
                        {$submenu}
                    </div>
                {/if}
                <div class="vervolgContent {if !empty($submenu)}subcontent{/if}">
                
            

                    {*if !empty($submenu) && !empty($parent_title)}<h1>{title}</h1>{/if*}
                    {$content}
                </div>
            </div>
            {if empty($sidebarCheck)}
            {assign var="blocksCount" value=3}
            {if empty($subscription)}{$blocksCount = $blocksCount - 1}{/if}
            {if empty($extra)}{$blocksCount = $blocksCount - 1}{/if}
            <div class="sidebar clearfix items{$blocksCount}">
                <div class="directions">
                    {if !empty($directions)}
                        {$directions}
                    {else}
                        {langify_gcb name="sidebar_directions"}
                    {/if}
                </div>
                {if empty($subscription)}
                    <div class="subscription">
                        {langify_gcb name="sidebar_subscription"}
                    </div>
                {/if}
                {if empty($extra)}
                    <div class="extra hisrc">
                        {langify_gcb name="sidebar_extra"}
                    </div>
                {/if}
            </div>
            {/if}
        </div>
    </div>
    <div id="footer">
    {global_content name='tpl_footer'}
    </div>
</div>

{global_content name='tpl_close'}
HTML blobs
tpl_open

Code: Select all

{babel action="assign"}
{updatecss}
{assign_shortlang}
{process_currentpagealias} 

    {$content = "{content}" scope=global}

    {$canonical_url = $canonical_url|default:"{$content_obj->GetURL()|lower|default:''}" scope=global}
    {*RedirectCanonical canonical_url=$canonical_url exclude='page-alias'*} {* -> http://cms.ms/9xmT *}
    {$short_url = $short_url|default:$canonical_url scope=global}
    {$previous_url = $previous_url|default:"{cms_selflink dir='prev' urlonly=1}" scope=global}
    {$next_url = $next_url|default:"{cms_selflink dir='next' urlonly=1}" scope=global}

    {$site_name = $site_name|default:"{sitename}" scope=global}

    {$page_description = $page_description|default:"{description}"}
    {$page_description = $page_description|default:$content|strip_tags:false|strip|trim|truncate:300|default:'' scope=global}
    {$page_lang = $page_lang|default:'nl' scope=global}
    {$page_modified = $page_modified|default:"{modified_date format='%e-%m-%Y'}" scope=global}
    {$page_title = $page_title|default:"{title}" scope=global}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>	
    <title>{$page_title}</title>
<__html lang="{$page_lang}">
    <meta charset="utf-8">
    {metadata|strip}

<meta name="application-name" content="{$site_name}">
<meta name="copyright" content="Copyright (C) {$site_name}, Alle rechten voorbehouden">
<meta name="description" content="{$page_description}">
<meta name="generator" content="{$site_name} - Copyright (C) 2004-{$smarty.now|date_format:'%Y'}">

<link rel="canonical" href="{$canonical_url}/">
<link rel="shortlink" href="{$short_url}">
<link rel="start" href="{root_url}">


	<meta name="robots" content="index,follow">
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

{* Open Graph tags for Facebook *}
<meta property="og:description" content="{$page_description}">
<meta property="og:image" content="{$page_image}">
<meta property="og:site_name" content="{$site_name}">
<meta property="og:title" content="{$page_title}">
<meta property="og:type" content="website">
<meta property="og:updated_time" content="{$page_modified}">
<meta property="og:url" content="{$short_url}/"

{* Meta tags for Twitter *}
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@SOMTUniversity"> 
<meta name="twitter:description" content="{$page_description}">
<meta name="twitter:dnt" content="on"> {* do not track visitors *}
<meta name="twitter:domain" content="{$root_url}">
<meta name="twitter:image" content="{$page_image}">
<meta name="twitter:site" content="@SOMTUniversity">
<meta name="twitter:title" content="{$page_title}">
<meta name="twitter:url" content="{$short_url}/">

<__script__>
 dataLayer = []; //Placeholder - information will follow
</__script>
<__script__>
 dataLayer.push({
'canonical_url':'{$canonical_url}',
'title':'{$page_title}',
'datum':'{$postdate}',
'gewijzigd':'{$page_modified}',
'beschrijving':'{$page_description}',
'category':'{$category}',
'author':'{$author}'
});
</__script>

<!-- Google Tag Manager -->
<__script__>{literal}(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-M4CWTTN');{/literal}</__script>
<!-- End Google Tag Manager -->

<!-- CSS -->
<!-- link rel="stylesheet" type="text/css" href="{uploads_url}/bootstrap.min.css" -->

	{cms_selflink dir="start" rellink=1}
	{cms_selflink dir="prev" rellink=1}
	{cms_selflink dir="next" rellink=1}

<!-- Javascript -->	
	{if isset($cms_admin_user_id) && $cms_admin_user_id > 0}
		{cms_stylesheet nocombine="1"}
	<__script__ type="text/javascript" src="{uploads_url}/javascript/jquery-1.8.3.min.js"></__script>
	{else}
		{cms_stylesheet}
		<__script__ type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.min.js"></__script>
	{/if}
	<__script__> $(document).ready(function () {
   $('.hisrc img, img.hisrc').hisrc({
    useTransparentGif: true,
    speedTestUri: '{uploads_url}/images/50K.jpg',
    transparentGifSrc: '{uploads_url}/images/spacer.gif'
   });
});
	</__script>

{*<__script__>{literal}  (function(d) {  var config = {  kitId: 'nkg6cuy',  scriptTimeout: 3000  },  h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)  })(document); {/literal}</__script>*}

{literal}
<__script__ async src="https://use.typekit.net/fjg5tsf.js"></__script>
<__script__>try{Typekit.load({ async: true });}catch(e){}</__script>
{/literal}

</head>
</__body>
<!-- Google Tag Manager (noscript) -->
<noscript>{literal}<__iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M4CWTTN"
height="0" width="0" style="display:none;visibility:hidden"></__iframe>{/literal}</noscript>
<!-- End Google Tag Manager (noscript) -->

<div class="page_{$currentpagealias}">
<!-- END tpl_open -->
tpl_header

Code: Select all

<!-- start tpl_header -->
{get_root_page_alias}

<div class="mobileMenu">
	{search resultpage="zoeken"}
	<!--{menu childrenof=$root_page_alias number_of_levels="2"}-->
        <!--{menu level0=$root_page_alias number_of_levels="0"}-->
 <!--        {menu level1=$root_page_alias number_of_levels="1"}-->
       {menu level2=$root_page_alias number_of_levels="2"}

</div>
<div class="strip">
	<div class="container">
		<a class="logo hisrc" href="{root_url}">
			<img class="full" width="179" height="65" src="{uploads_url}/images/site/footer/logo_new.png" alt="SOMT University of Physiotherapy" data-1x="{uploads_url}/images/site/footer/logo_new.png" data-2x="{uploads_url}/images/site/footer/logo_new.png" alt="SOMT University of Physiotherapy" />
			<img class="small" height="34" src="{uploads_url}/images/site/header/somt_schild.png" alt="" data-1x="{uploads_url}/images/site/header/somt_schild.png" data-2x="{uploads_url}/images/site/header/somt_schild.png" />
		</a>
		<a class="search desktop">
			{*<img class="normal hisrc" src="{uploads_url}/images/site/header/search.png" alt="" data-1x="{uploads_url}/images/site/header/search.png" data-2x="{uploads_url}/images/site/header/search_2x.png" />*}
			<img class="normal" src="{uploads_url}/images/site/header/search_2x.png" alt=""/>
			<img class="hover" src="{uploads_url}/images/site/mobile/search_icon.png"/>
		</a>
		{*babel action="menu"*}
		<!--{menu childrenof=$root_page_alias number_of_levels="2"}-->
                {menu level2=$root_page_alias number_of_levels="2"}
		<a class="mobileMenuButton clearfix">
			<img class="normal" src="{uploads_url}/images/site/mobile/menu_icon_blue.png" alt=""/>
			<img class="hover" src="{uploads_url}/images/site/mobile/menu_icon.png" alt=""/>
		</a>
	</div>
	<div class="searchForm">
		<div class="container">
			{search resultpage="zoeken"}
		</div>
	</div>
</div>
<!-- end tpl_header -->
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: $content is breaking search result page / blank searchre

Post by velden »

I would put this {$content=...} at the top of the PAGE template and not inside a HTML blob.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1621
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: $content is breaking search result page / blank searchre

Post by DIGI3 »

Also keep in mind that I think in 1.x all Smarty variables were global, the assign=global might be causing a problem. You're going to struggle with any tutorials and support until you upgrade - you may want to prioritize that over adding features.
Not getting the answer you need? CMSMS support options
mikes84
New Member
New Member
Posts: 5
Joined: Tue Apr 09, 2019 11:45 am

Re: $content is breaking search result page / blank searchre

Post by mikes84 »

DIGI3 wrote:You're going to struggle with any tutorials and support until you upgrade - you may want to prioritize that over adding features.
Yeah I know but thanks for reminding me. This whole website 'take over' has been quick and dirty all the way down. Upgrading was to risk at the time. I'll put it back on the table.
mikes84
New Member
New Member
Posts: 5
Joined: Tue Apr 09, 2019 11:45 am

Re: $content is breaking search result page / blank searchre

Post by mikes84 »

velden wrote:I would put this {$content=...} at the top of the PAGE template and not inside a HTML blob.
Thanks, I tried it. Gives me an error on saving the page template and won't save:
Duplicate content block: 'content_en'
This 'content_en' I can't seem to find anywhere. Do you have any thoughts on that?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1621
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: $content is breaking search result page / blank searchre

Post by DIGI3 »

content_en is the default {content} block, so it means that you're probably assigning it, but then also calling it instead of the assigned variable.

So if you do {$content="{content}"} then later in your template you need to make sure to use {$content} rather than {content}
Not getting the answer you need? CMSMS support options
mikes84
New Member
New Member
Posts: 5
Joined: Tue Apr 09, 2019 11:45 am

Re: $content is breaking search result page / blank searchre

Post by mikes84 »

DIGI3 wrote:content_en is the default {content} block, so it means that you're probably assigning it, but then also calling it instead of the assigned variable.

So if you do {$content="{content}"} then later in your template you need to make sure to use {$content} rather than {content}
I see. Thanks DIGI3.
The only other instance in the page where it is used already was {$content}, so the error persists. It is the template from the OP. Am I missing something? To me there is only one use of the tag here.

Code: Select all

                    {*if !empty($submenu) && !empty($parent_title)}<h1>{title}</h1>{/if*}
                    {$content}
                </div>
Thanks for reading along!
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1621
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: $content is breaking search result page / blank searchre

Post by DIGI3 »

I'm afraid I don't have any other ideas without digging in myself - you may just need to comment out or remove parts of the template until you can narrow it down.
Not getting the answer you need? CMSMS support options
mikes84
New Member
New Member
Posts: 5
Joined: Tue Apr 09, 2019 11:45 am

Re: $content is breaking search result page / blank searche

Post by mikes84 »

DIGI3 wrote:you may just need to comment out or remove parts of the template until you can narrow it down.
And so I did. It was this line in the template that cause the error

Code: Select all

{content label="Page content" assign="content"}
Now it's deleted the page search is working, and the automated metatags are still working.

For future reference. The top of the template I posted before now looks like this.

Code: Select all

{process_pagedata}
{$content = "{content}" scope=global}
{global_content name='tpl_open'}

{content_module block_group="Header" module="JMFilePicker" mode="browser" dir="images/" label="Header image" block="headerBg" assign="headerBg"}
{if empty($headerBg)}{assign var="headerBg" value="images/site/header/followpage_header.png"}{/if}
{content_module block_group="Header" module="JMFilePicker" mode="browser" dir="images/" label="Header image retina (2x)" block="headerBg2x" assign="headerBg2x"}
{if empty($headerBg)}{assign var="headerBg2x" value="images/site/header/followpage_header_2x.png"}{/if}

{*content label="Page content" assign="content"*}
{content block_group="Sidebar" block_type="checkbox" label="Hide sidebar?" block="sidebarCheck" assign="sidebarCheck"}
{content block_group="Sidebar" block_type="checkbox" label="Hide subscription?" block="subscription" assign="subscription"}
{content block_group="Sidebar" block_type="checkbox" label="Hide extra?" block="extra" assign="extra"}
{content block_group="Sidebar" label="Sidebar content" block="directions" assign="directions"}
<div class="tpl_vervolg">
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: $content is breaking search result page / blank searchre

Post by velden »

content_en is the default {content} block, so it means that you're probably assigning it, but then also calling it instead of the assigned variable.
This was exactly what was meant by DIGI3, but probably we should have explained in a little more detail. The 'default content block' (also referenced as content_en) is a {content ...} tag without the 'block' parameter.

You can (obviously) only have one in your templates (or chain of parent-child) templates.

Good you found out now.
Post Reply

Return to “CMSMS Core”