custom page view

7 posts by 2 authors in: Forums > CMS Builder
Last Post: March 20, 2008   (RSS)

By Chris_t - March 20, 2008

Hello All,

Alright I am close to having this worked out I am sure it is just a matter of formating it correctly. here is my code for the xml file


<?php
require_once "/home/ragefoot/public_html/cmsAdmin/lib/viewer_functions.php";
$options = array(); // NOTE: see online documentation for more details on these options
$options['tableName'] = 'player'; // (REQUIRED) MySQL tablename to list record from. Example: "article";
$options['recordNum'] = ''; // (optional) Record number to display. Example: "1"; Defaults to number on end of url, then 1
$options['where'] = "dancer_slide_show = 'name'"; // (ADVANCED) MySQL WHERE conditions to use INSTEAD of recordNum to look up record. Example: "fieldname = 'value'"
$record = getRecord($options);
?>
<playlist xmlns="http://xspf.org/ns/0/" version="1">
<trackList>
<?php foreach (getUploads($options['tableName'], 'dancer_slide_show', $record['num']) as $upload): ?>
<track>
</location>http://www.ragefootball.com/cmsAdmin/uploads/Dancers/<?php echo $upload['filename'] ?><location>
</track>
<?php endforeach ?>
</trackList>
</playlist>


I get "Page Viewer (player): MySQL Error: Unknown column 'dancer_slide_show' in 'where clause'"

With that I am sure all I need to do is define the field dancer_slide_show with a value of just one dancer like her name so it shows just the pictures uploaded in her entry. because the xml file is a separate file I am not sure it can look up the url and get the number. Let me know if any of you smart people can shed some light on this.

Thanks
Chris

Re: [ChrisTitchenal] custom page view

By Dave - March 20, 2008

Hi Chris,

So 'dancer_slide_show' is an upload field in the 'player' section (or will be a field)? Is that right? Or will there be a separate section for dancers?

Either way you'd probably want to lookup the dancer by player (or dancer name) or record number.

Are the dancers in the same record and section as the players or how will they be stored?
Dave Edis - Senior Developer
interactivetools.com

Re: [ChrisTitchenal] custom page view

By Chris_t - March 20, 2008 - edited: March 20, 2008

Alright been messing with the code

<?php
require_once "/home/ragefoot/public_html/cmsAdmin/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'player';
$options['recordNum'] = '90';
$options['where'] = '';
$record = getRecord($options);
?>
<playlist xmlns="http://xspf.org/ns/0/" version="1">
<trackList>
<?php foreach (getUploads($options['tableName'], 'dancer_slide_show', $record['num']) as $upload): ?>
<track>

<location>http://www.ragefootball.com/cmsAdmin/uploads/Dancers/<?php echo $upload['filename'] ?></location>
</track>
<?php endforeach ?>
</trackList>
</playlist>


Will get me the image to load.

I had to tell it a recordNum to get it to do that. So now I need to figure out how to pass a number to it and have it display the matching ones.

Thanks

Re: [ChrisTitchenal] custom page view

By Dave - March 20, 2008

Ok, I think I got it. You have a page called dancerPage.php that shows details on specific dancer, but you don't want images shown on that page directly, because you're using a flash slideshow (_on that page_) which needs to load the images from an XML config file. Is that right?

If it is, you'd probably display dancer pages with an url like this: dancerPage.php?dancer-name-3/

If so, just blank out the where option on your XML page (I'm going to pretend it's called dancePageXML.php) and link to it directly the same way: dancerPageXML.php?dancer-name-3/

The part after the ? in the url is called the "query string" and you can link from dancerPage.php to dancerPageXML.php like this to pass it along:

dancerPageXML.php?<?php echo @$_SERVER['QUERY_STRING']; ?>

Let me know if that works. You can test it during development by linking directly to urls like dancerPageXML.php?3 and viewing source and making sure it's creating the right XML.

Hope that helps, if I totally misunderstood let me know! ;)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] custom page view

By Chris_t - March 20, 2008

Trust me Tom I am the more confused one. You are talking to a guy that has a portfolio full of Illustrator work so yeah my job description has changed a lot. I got your message at the same time as I posted my update. If you go to
http://www.ragefootball.com/dancerPage.php?96/
you will see the slide show in action.
On dancerPage.php I have this code
<script type="text/javascript">
var so = new SWFObject('http://www.ragefootball.com/test/imagerotator.swf','mpl','275','418','8');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('height','418');
so.addVariable('width','275');
so.addVariable('file','http://www.ragefootball.com/test/imagelist.php.xml');
so.addVariable('transition','fade');
so.addVariable('enablejs','true');
so.addVariable('linkfromdisplay','true');
so.write('player');
</script>
I could write it like this if you think it would help
<embed
src="http://www.ragefootball.com/test/imagerotator.swf"
width="275"
height="418"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="height=418&width=275&file=http://www.ragefootball.com/test/imagelist.php.xml&transition=fade"
/>

With the imagelist.php.xml looking like this
<?php
require_once "/home/ragefoot/public_html/cmsAdmin/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'player';
$options['recordNum'] = '90';
$options['where'] = '';
$record = getRecord($options);
?>
<playlist xmlns="http://xspf.org/ns/0/" version="1">
<trackList>
<?php foreach (getUploads($options['tableName'], 'dancer_slide_show', $record['num']) as $upload): ?>
<track>

<location>http://www.ragefootball.com/cmsAdmin/uploads/Dancers/<?php echo $upload['filename'] ?></location>
</track>
<?php endforeach ?>
</trackList>
</playlist>

So that gets to the point I am at.
you can view the xml file output by going here
http://www.ragefootball.com/test/imagelist.php.xml
I tried to place dancerPageXML.php?<?php echo @$_SERVER['QUERY_STRING']; ?>
in the xml file at the $options['where'] = ''; and got this error "Parse error: syntax error, unexpected T_STRING in /home/ragefoot/public_html/test/imagelist.php.xml on line 6"

I know we are close Dave I can feel it or I would have told the client not that can't be done LOL.

Thanks for your time
Chris

Re: [ChrisTitchenal] custom page view

By Dave - March 20, 2008 - edited: March 20, 2008

Ok, in dancerPage.php change the 'file' line to this:

so.addVariable('file','http://www.ragefootball.com/test/imagelist.php.xml?<?php echo @$_SERVER['QUERY_STRING']; ?>');

So it passes the record number to the php xml file. Next, in imagelist.php.xml change the recordNum option to this:

$options['recordNum'] = '';

So it loads the record number from the url.

If that doesn't do it, feel free to email me FTP and I can get in there and take a look.

Hope that helps! :)
Dave Edis - Senior Developer
interactivetools.com