Webmastersite.net
Register Log In

Trying to "Show Custom Template"

Comments on Trying to "Show Custom Template"

mschamber


Usergroup: Customer
Joined: Apr 20, 2011
Location: Mount Shasta, CA

Total Topics: 3
Total Comments: 10
Posted May 06, 2011 - 11:55 PM:

This is perhaps my largest hurdle to completing my conversion to WSN Directory. I need to be able to display entries from a specific category on a page outside the WSN directory - many different categories on many different pages. I have tried to do this, according to these instructions. I added a _GET with the category ID, as per the instructions here.

Here is the page in question.

What I've gotten is a whole slew of error statements. 12, in fact. Below them, the category title and subcategories DO in fact output, but no listings display.

Here's the first error:
Error occurred at http://mtshastachamber.com/directory/test.php on 2011-05-07 04:45:18. Error text: Warning #512: 'Unparsed template variable(s) in config line attachments,time,50,ascending,type='link' AND objectid={LINKEFFECTIVEID} AND (filetitle LIKE '%.jpg' OR filetitle LIKE '%.jpeg' OR filetitle LIKE '%.png' OR filetitle LIKE '%.gif'),,,0,0,0,0,0,0,,0 of toplist #10 in template templates/default/dining.tpl!' in includes/commonfuncs.php on line 5401
Step 1 of backtrace:
File: includes/commonfuncs.php
Line: 5401
Function: trigger_error
Arguments:


Step 2 of backtrace:
File: end.php
Line: 644
Function: runtoplist
Arguments:


Step 3 of backtrace:
File: index.php
Line: 225
Function: require
Arguments: end.php


Step 4 of backtrace:
File: /usr/www/users/mscoc/mtshastachamber.com/visitor/dining/test.php
Line: 34
Function: require
Arguments: index.php


The referring URL was .


I just overwrote all of my template files with a brand new set from 6.0.25, only editing a few files that were customized, to see if that helped, but to no avail.

I have no idea what these errors mean - can anyone provide guidance? I am really lost... confused
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 07, 2011 - 1:30 PM:

This means the content of your test.php is wrong, in that it's not calling any specific categories, and thus you're not allowed to use the toplists that normally go on the 'show listings in category' page. What did you type?
mschamber


Usergroup: Customer
Joined: Apr 20, 2011
Location: Mount Shasta, CA

Total Topics: 3
Total Comments: 10
Posted May 07, 2011 - 2:22 PM:

I put "$_GET['catid'] = '400';" - that was the category id I was trying to retrieve listings for.

Here's the code I'm using on test.php:


<?php
/* Supply the path to WSN and the name of your template on the lines as requested */

$pathtowsn = '/usr/www/users/mscoc/mtshastachamber.com/directory/'; // as listed on your settings->general configuation page but without the 'attachments/' part

$yourtemplatename = 'dining.tpl'; // the template, located in the 'custom' subdirectory of your templates directory, that you want to display

$usewrapper = 'no'; // set to 'no' if you don't want to show the WSN wrapper

$curr_path = getcwd();
chdir($pathtowsn);

$_GET['custom'] = 'yes';
$_GET['TID'] = 'dining';
$_REQUEST['TID'] = $_GET['TID']; $_REQUEST['custom'] = $_GET['custom'];
$_GET['catid'] = '400';
require 'index.php';

chdir($curr_path);
?>


I've also tried the first version of the custom template code, same errors:

<?php
/* Supply the path to WSN and the name of your template on the lines as requested */

$pathtowsn = '/usr/www/users/mscoc/mtshastachamber.com/directory/'; // as listed on your settings->general configuation page but without the 'attachments/' part

$yourtemplatename = 'dining.tpl'; // the template, located in the 'custom' subdirectory of your templates directory, that you want to display

$usewrapper = 'no'; // set to 'no' if you don't want to show the WSN wrapper

$curr_path = getcwd();
chdir($pathtowsn);

require 'start.php';
if (!$template) $template = new template('custom/'. $yourtemplatename);
require 'end.php';

chdir($curr_path);
?>
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 08, 2011 - 12:10 AM:

mschamber wrote:
I put "$_GET['catid'] = '400';" - that was the category id I was trying to retrieve listings for.


You need to use all the parameters that you see in the URL. Category URLs are of the form index.php?action=displaycat&catid=x, so you need $_GET['action'] = 'displaycat'; also.


<?php
/* Supply the path to WSN and the name of your template on the lines as requested */

$pathtowsn = '/usr/www/users/mscoc/mtshastachamber.com/directory/'; // as listed on your settings->general configuation page but without the 'attachments/' part

$yourtemplatename = 'dining.tpl'; // the template, located in the 'custom' subdirectory of your templates directory, that you want to display

$usewrapper = 'no'; // set to 'no' if you don't want to show the WSN wrapper

$curr_path = getcwd();
chdir($pathtowsn);

$_GET['custom'] = 'yes';
$_GET['TID'] = 'dining';
$_GET['catid'] = '400';
$_GET['action'] = 'displaycat';
$_REQUEST['TID'] = $_GET['TID']; $_REQUEST['custom'] = $_GET['custom']; $_REQUEST['action'] = $_GET['action']; $_REQUEST['catid'] = $_GET['catid'];
require 'index.php';

chdir($curr_path);
?>

mschamber


Usergroup: Customer
Joined: Apr 20, 2011
Location: Mount Shasta, CA

Total Topics: 3
Total Comments: 10
Posted May 08, 2011 - 12:33 AM:

IT WORKED!! nod Thank you so much, you are my hero!
mschamber


Usergroup: Customer
Joined: Apr 20, 2011
Location: Mount Shasta, CA

Total Topics: 3
Total Comments: 10
Posted May 08, 2011 - 3:22 PM:

One thing I've noticed this morning, looking at it again, is that the Google map doesn't display:

No map: http://mtshastachamber.com/visitor/dining/test.php
Map: mtshastachamber.com/directo...ction=displaycat&catid=400

Is there anything I can set or tweak to get the map to display?

I'm also trying to display these templates from within WordPress (using a WP template file). This seems to produce a completely different kind of error: http://visitmtshasta.com/dining/ (the code I'm using is the same as I posted previously, but with the $_GET['action'] = 'displaycat'; added.)

I realize I'm asking for some complicated things here... confused
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 16, 2011 - 1:47 AM:

The reason the maps don't work is that all of the WSN javascript is missing. This is a result of your suppressing the wrapper template. I'd suggest using a custom wrapper instead:
$_GET['customwrapper'] = 'wrappertemplatename';
$_REQUEST['customwrapper'] = 'wrappertemplatename';

I'll look into if it's feasible to get the javascript included when suppressing the wrapper.

WordPress can presumably only use WordPress templates, not WSN templates.
mschamber


Usergroup: Customer
Joined: Apr 20, 2011
Location: Mount Shasta, CA

Total Topics: 3
Total Comments: 10
Posted May 17, 2011 - 12:50 AM:

Thanks for your help - I reformatted the template file and used the wrapper, that did the trick.

I appreciate your patience!
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.