Can I do this with Coranto

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Can I do this with Coranto

Postby AndyP » Tue Aug 16, 2005 12:54 pm

I've been around here a long time and am experienced with Coranto to a great extent but the reason I am asking the question "can this be done" is that I think I need a bit more than Coranto...I think...

I am using Coranto to store sports stats. I have created different fields and just as I would enter a news article am putting the data in which is easy. I am also using some javascript to generate a sortable table by different categories. That part works sweetly. Each athlete who is entered into the database also has their own static page created with their stats listed on it. These can be included into a separate webpage as appropriate using SSI...

Here's what I want to do...

I want the user to be able to choose two athletes to compare against each other. They choose one from a drop down box (the drop down box was easy to create using a profile and style) and a second athlete from a second drop down box. I then want them to be able to click and be taken to a page where those two athletes stats are listed next to each other so they can be compared.

I can create a static page myself with the stats of each inserted in the page using SSI, that would be easy... but I want it to be dynamic so the user can pick the athletes themselves and the page presents the stats.

Back to the original question, can this be done ?
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby SrNupsen » Tue Aug 16, 2005 1:21 pm

Hm...I would think so. Or I am possibly not understanding what you wish to do...

You would ofcourse need every athlete's stats stored as static files. If you want to use the pages allready created, that's fine, if not you'll need a new style customized in Coranto to display this (and a Maginot static profile to generate these stats pages)

Then you create your dropdown boxes, allow your visitors to choose one athelete from each box (say "Bill" and "Ben"). Then pass Bill and Ben in the query string when moving to the next page, say http://mysite.com/compare.php&name1=Bill&name2=Ben - or use javascript to update your page on the fly.

Include Bill's stats file, then include Ben's. In Iframes, using CSS or whatever.

Or what is it you're trying to accomplish?

SrNupsen
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby AndyP » Tue Aug 16, 2005 2:41 pm

SrNupsen wrote:Hm...I would think so. Or I am possibly not understanding what you wish to do...

You would ofcourse need every athlete's stats stored as static files. If you want to use the pages allready created, that's fine, if not you'll need a new style customized in Coranto to display this (and a Maginot static profile to generate these stats pages)

Then you create your dropdown boxes, allow your visitors to choose one athelete from each box (say "Bill" and "Ben"). Then pass Bill and Ben in the query string when moving to the next page, say http://mysite.com/compare.php&name1=Bill&name2=Ben - or use javascript to update your page on the fly.

Include Bill's stats file, then include Ben's. In Iframes, using CSS or whatever.

Or what is it you're trying to accomplish?

SrNupsen


Thanks for responding...

You have the right idea on what I want to achieve. Both the php(query string) and javascript ideas sound the most ideal for giving me the best results.

As far as the javascript one is concerned, how could that be achieved ? I found the following ... http://dynamicdrive.com/dynamicindex17/comboviewer.htm ... which I was checking out as a possibility. I like the way the drop down box can change the content but ran into issues about having each <div id=..) numbered sequentially from 0 onwards...

The php one is probably easiest but again I am not familiar with php. I have done a php page where you can type a name in a text field and send it to the next page where it prints that persons name. I guess the php could be adapted to work in that way ?

I've gotten so far on this but I guess I need a little help when it comes to the coding.
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby SrNupsen » Tue Aug 16, 2005 4:16 pm

Yup, that's exactly what you'd need. First, you may design the actual page (where the 2 are compared) any way you want. Then, where you want the first athlete's stats to appear, you include the corresponding text file. Same goes for the second athlete.

Sorry I can't help you out with the actualy PHP coding (should be 3 lines or so), but I'm a PHP newbie myself. You also need basic security string check, so that people won't be able to call your compare.php script with evil things in the query string.

Perhaps somebody more skilled in PHP feels like stating a couple of lines of code? Don't know if kriko checks these forums anymore, btw...

SrNupsen
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby AndyP » Tue Aug 16, 2005 4:33 pm

First of all thanks :)... here's what I have so far...

File called form.html

Code: Select all
<html>
<body>

<form action="compare.php" method="POST">
Cool or not: <select name="coolness">
    <option value="cool">Cool</option>
    <option value="notcool">Not cool</option>
  </select>
<input type="submit" />
</form>

</body>
</html>


which is a form with a drop down box and you choose if you are cool or not... followed by welcome.php

Code: Select all
<html>
<body>
<?php include("$coolness.txt"); ?>
</body>
</html>

which is an output file that includes a file called cool.txt or notcool.txt depending on what was selected :)

That works and can easily be adapted but I'm worried about the security aspect. If anyone can shed any light on that I'd appreciate it.
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby AndyP » Fri Aug 26, 2005 5:05 pm

Ok, I found I needed to do something extra to make it secure and PHP is making me nervous now.

Can this be done using CGI ?

Just to recap all I want to do is offer my visitors two drop down boxes from which they can select something and be taken to a page where both of their selections are included using SSI.
AndyP
 
Posts: 165
Joined: Wed Jan 10, 2007 10:10 pm

Postby Parahead » Fri Aug 26, 2005 8:22 pm

AndyP wrote:Ok, I found I needed to do something extra to make it secure and PHP is making me nervous now.

Can this be done using CGI ?
PHP/Perl, same same but different... ;-) The actual include can be done with any of those. I would suggest that you have a base path that the files you would like to includ is located. That path you define inside your script, then you use the parameters sent to the script and clean it from any malicious characters (like . and /) and padd that to the basepath you have. I am no PHP coder, so this may contain syntax errors, but using your above example:
Code: Select all
<html>
<body>
<table>
 <tr>
  <td><?php include($basepath$cleanfilename1.txt"); ?></td>
  <td><?php include($basepath$cleanfilename2.txt"); ?></td>
 </tr>
</table>
</body>
</html>
If you would like to have examples of how to read input data, take a look inside Coranto and search for the ReadForm sub (in crlib.pl). For examples of cleaning path, check out the Maginot addon and search for the Maginot_MakePath sub (the last part of it) and Maginot_KillChars sub.
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden


Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron