[solved?] {content} and {global_content name='Contact'} not working

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.
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

[solved?] {content} and {global_content name='Contact'} not working

Post by elfduck »

Hi

I can't get {content} and {global_content name='Contact'} to work, I only get an error about the global content block:

Code: Select all

string(67) "Smarty error: unable to read resource: "globalcontent:Contact"" string(67)
"Smarty error: unable to read resource: "globalcontent:Contact""
I have checked out that I really do have a global content block "Contact" there. I am using user defined tags to retrieve data from another database, using $_GET['id'] variable I retrieve from the address bar.

{title} works fine btw.

I am using CMS Made Simple 1.5.2 "Caguas" and this is the first version I have installed, I haven't upgraded it from an older version.

Thanks in advance.
Last edited by elfduck on Wed Mar 11, 2009 7:33 am, edited 1 time in total.
Well it computes a little...
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: {content} and {global_content name='Contact'} not working

Post by tyman00 »

Double check your spelling and the case. It is case-sensitive.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

I did, once again, it doesn't work... Also I noticed that all those CMSMS-tags work, that are before my user defined tags. All CMSMS-tags after my user defined tags do not work.
Well it computes a little...
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: {content} and {global_content name='Contact'} not working

Post by RonnyK »

Could you post the logic as it is put by you in the template or content-page.

If it is the content-page, then post the HTML as well, to make sure that it isnt wysiwyg that gets in the way..

Ronny
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

Could you post the logic as it is put by you in the template or content-page.
What does that mean?


Here is one of my non-working templates:

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" xml:lang="en" >
<head>
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}
</head>
</__body>

<!-- start wrapper -->
<div id="wrapper">

  <!-- start logowrapper -->
  <div id="logowrapper">

    <!-- start logo -->
    <div id="logo">
      <a href="index.php" target="_top"><img alt="Logo" border="0" height="58" src="images/logo.jpg" width="288" /></a>
    </div>
    <!-- end logo -->

    <!-- start search -->
    <div id="search">
      {search resultpage="search" searchtext=""}
    </div>
    <!-- end search -->

 </div>
 <!-- end logowrapper -->

  <!-- start header -->
  <div id="header">
  </div>
  <!-- end header -->

  <!-- start menu -->
  <div id="menu">
    {menu template="Menu"}
  </div>
  <!-- end menu -->

  <!-- start contentwrapper -->
  <div id="contentwrapper">

    <!-- start leftsection -->
    <div id="leftsection">

      <div class="blockwrapper">
        <div class="blocktitle">
          Weekly place
        </div>
        <div class="blockcontent">
          {news detailpage="weeklyplace" moretext="Read more..." number="1"}
        </div>
      </div>

    </div>
    <!-- end leftsection -->

    <!-- start content -->
    <div id="content">
      <h1>{title}</h1>
      {content}
    </div>
    <!-- end content -->

    <!-- start rightsection -->
    <div id="rightsection">

      <!-- start placesearch -->
      <div class="blockwrapper">
        <div class="blocktitle">
          Search a place
        </div>
        <div class="blockcontent">
          {placesearch}
        </div>
      </div>
      <!-- end placesearch -->

      <!-- start famous places -->
      <div class="blockwrapper">
        <div class="blocktitle">
          Famous places
        </div>
        <div class="blockcontent">
          {random_blob prefix="Famous_places"}
        </div>
      </div>
      <!-- end famous places -->

    </div>
    <!-- end rightsection -->

  </div>
  <!-- end contentwrapper -->

  <!-- start footer -->
  <div id="footer">
    {global_content name='Contact'}
  </div>
  <!-- end footer -->

</div>
<!-- end wrapper -->

<__body>
</__html>
Well it computes a little...
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: {content} and {global_content name='Contact'} not working

Post by RonnyK »

OK...

and what is inside the GCB, in its html-source, so not in the wysiwyg?

Ronny
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

In the GCB "Contact" there is only some text, without HTML.

In those "Famous_places" GCBs is HTML, a picture and some text and sometimes a link to another page, too.
Well it computes a little...
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: {content} and {global_content name='Contact'} not working

Post by RonnyK »

And you call nothing in the GCB, beside some text?

As with only text the logic shouldnt error.... I can only imagine this kind of errors, when you have some logic in...

Ronny
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

Basically, the "Contact" GCB contains something like this:

Code: Select all

Organization | Mailing address | Phone number | Fax | Email

And the "Famous_places" GCB(s) contains something like this:

Code: Select all

<img title="Famous place" src="uploads/images/famous_place1.jpg" alt="Famous place"
width="170" height="128" /><br /><br />Here is one famous place. Nice looking scenery, I must say.
These are just some random content I have inserted to show something until I get the real content to put in there. In my mind, my user defined tags mess up the global content blocks or something, I don't know.
Well it computes a little...
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: {content} and {global_content name='Contact'} not working

Post by tyman00 »

Try removing this from your template: {random_blob prefix="Famous_places"}

I am not sure if it compatible anymore. The prefix part is not the actual name of the content block. It is usually the first part of the name that would be common amongst other names. In this example you would want to use "Famous_"
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

Sorry, I was away for the weekend...

I tried to remove that random global content block thingy, but the problem still exists...

???
Well it computes a little...
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

I tried now two more things, to wrap my code inside {php}...{/php}-tags and to upgrade CMSMS into version 1.5.3. {php}...{/php}-tags had no effect (I also edited config.php for this, of course). Upgrading changed the error message into:

Code: Select all

string(67) "Smarty error: unable to read resource: "globalcontent:Contact"" 
Well it computes a little...
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

So I tried to narrow down the problem now. If I remove the user defined tag from my template, everything works perfectly. So the problem lies in the user defined tag I have made. I tried to change all the variable names from that, because I was thinking that maybe they are somehow changing CMSMS's own variables or whatever. In any case, it didn't work. So the only option I have left is to take my user defined tag elsewhere and create a pop-up page for it or I will simply create the website by hand, without CMSMS. I need it to work and I don't think a pop-up page is going to cut it... Please, if you have any suggestions, I'm willing to try just about anything.
Well it computes a little...
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: {content} and {global_content name='Contact'} not working

Post by tyman00 »

I am likely not going to be able to help. But if you post the UDT here, we may be able to see if we can notice something you did. Sometimes and outside view is all that is needed for a simple problem.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
User avatar
elfduck
Forum Members
Forum Members
Posts: 27
Joined: Thu Dec 18, 2008 6:45 am

Re: {content} and {global_content name='Contact'} not working

Post by elfduck »

All right, I'll add the first search I have in my frontpage template. I have changed the comments, variable names, array names, almost everything but the code itself for security and also because I use different language in those... Please note that the directory 'admin' is not the CMSMS admin dir.

Code: Select all

<?php

// Establish database connection
require_once('admin/database.php');

// Include functions
require_once('admin/functions/clean_string.php');
require_once('admin/functions/make_mysql_safe.php');

// Define variables
$localities = array();
$locality = (string) '';
$query = (string) '';
$row = array();

// List localities, database query
$query = mysql_query("SELECT locality FROM localities");

// If an error occurs, stop processing and echo error
if (!$query) {
  echo '<p>Database error.</p>' . "\n";
}

// Otherwise process the database query
else {

  // Loop database rows
  while ($row = mysql_fetch_array($query)) {

    // If locality does not exist in array, add it
    if (!in_array($localities)) {
      $localities[] = $row['locality'];
    }
  }

  // Clear the memory used by the database query
  mysql_free_result($query);

  // Remove duplicates from the localities array
  $localities = array_unique($localities);

  // Sort the localities array
  sort($localities);
}

echo '<form action="index.php?page=searchresults" method="post" name="frmplacesearch">' . "\n";
echo '<b>Locality:</b><br />' . "\n";
echo '<select class="select" name="locality" style="width: 166px;">' . "\n";

// Loop through the localities from the array
foreach($localities as $locality) {

  // Echo localities for user selection
  echo '<option value="' . $locality. '">' . $locality. '</option>' . "\n";
}

echo '</select><br />' . "\n";
echo '<br />' . "\n";
echo '<b>Search:</b><br />' . "\n";
echo '<input class="text" maxlength="25" name="txtsearch" size="25" type="text" /><br />' . "\n";
echo '<br />' . "\n";
echo '<input class="button" name="btnsubmit" onclick="this.disabled=true,this.form.submit();" type="submit" value="Search" /><br />' . "\n";
echo '</form>' . "\n";

// Unset variables
unset($localities);
unset($locality);
unset($query);
unset($row);

// Close the database link in case it is still open
if (isset($dblink)) {
  mysql_close($dblink);
}

?>
edit:
Going away for the weekend again, I'll get back to you monday. Have a nice weekend all :)
Last edited by elfduck on Fri Mar 06, 2009 11:24 am, edited 1 time in total.
Well it computes a little...
Post Reply

Return to “CMSMS Core”