redirect from script to page

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
joostsoo
Forum Members
Forum Members
Posts: 57
Joined: Sun Sep 14, 2008 12:47 pm

redirect from script to page

Post by joostsoo »

Hello,
I hope someone can help me with this problem.
I'm running the latest version 1.11.3
I'm building a site that needs a script to read in some data and puts that in a database. Later on this data is presented again on an other page.
I use a script to get and read the data from a database.
This all works well, only I want the output from the script placed in a page within the CMS. I tryed it with redirect and a heather redirect but without succes.
I hope someone knows how I should solf this problem
Help will be greatly appriciated. :)

Regard Joost
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: redirect from script to page

Post by Wishbone »

Assuming that the script is PHP, you can put the script inside a User Defined Tag. Place the tag in the page.
joostsoo
Forum Members
Forum Members
Posts: 57
Joined: Sun Sep 14, 2008 12:47 pm

Re: redirect from script to page

Post by joostsoo »

Hello
Thanks for your repley.
After removing the <php tags it works.
I have one more question regarding this.
When I come from the first page, where a selection is made, the selection is passed on to the script.
I now changed the code so the script is no longer chosen but a page with a internal link.
How can I pass on the input paramater from the selection to the UDT?
I hope this is possible.
Yhanks for your help so far
Regards Joost
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: redirect from script to page

Post by Jos »

You can pass parameters to a UDT like this:

UDT smarty tag:
{myUDT myparam='myvalue'}

UDT php code:
$my_parameter_value = $params['myparam'];


A simple form in a UDT can look like this (just use tag {myUDT} without parameters):

Code: Select all

if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formsubmit']))
{
   $fieldvalue = $_POST['myfield'];
   echo '<p>Thanks for your submission: ' . htmlspecialchars($fieldvalue) . '</p>';
}
else
{
   echo '<form action="" method="post">';
   echo '<input type="text" name="myfield" value="" />';
   echo '<input type="submit" name="formsubmit" value="submit" />';
   echo '</form>';
}
Post Reply

Return to “CMSMS Core”