Pre-Content Header
Pre-Content Header
Heya all,
I have been using the cms made simple for a few days now and wow I am impressed. Finally a cms solution that has a focus on the layout and design in mind.
I do have one question though.
Usually when I develop a web - app/site I make forms so that the form submits to itself. Then in the header of the page I do processing like inserting to a database or validating the form data in PHP. These things I could do in the content of the page easily enough. However let say I have registration form and the user fills it out and its correct. After it is inserted into the DB I would like to call the PHP function:
header( "Location: thankyou.php" );
To redirect the user to a thank you for registering page.
This has to be done in the header before any html/php code is displayed in the browser.
What would be the solution if any to handle this code of processing with cmsms?
Essentially and pre-template code field for each content page would be the sweet...
Rob
I have been using the cms made simple for a few days now and wow I am impressed. Finally a cms solution that has a focus on the layout and design in mind.
I do have one question though.
Usually when I develop a web - app/site I make forms so that the form submits to itself. Then in the header of the page I do processing like inserting to a database or validating the form data in PHP. These things I could do in the content of the page easily enough. However let say I have registration form and the user fills it out and its correct. After it is inserted into the DB I would like to call the PHP function:
header( "Location: thankyou.php" );
To redirect the user to a thank you for registering page.
This has to be done in the header before any html/php code is displayed in the browser.
What would be the solution if any to handle this code of processing with cmsms?
Essentially and pre-template code field for each content page would be the sweet...
Rob
Pre-Content Header
That's a really good idea. I think that could be implemented pretty easily. Lemme think about it a little bit, but I'll try and have that in 0.7.
Thanks!
Thanks!
Solution Pre Content Header
I made a solution to all for php in the header of a page.
I added afield in the db for page_header
Then I went through all the code and I added in the advanced portion of content editing a textarea to handle the page_header.
Then added in the page displaying code the appropriate mysl field calls to get the page_header and add it to the template src.
So now in the advanced tab of content editing you can put the following:
{php} header("Location: p=?reg_thankyou");{/php}
life is good once again.
now I work on making a better menu than the dhtmlmenu.
the css is rubbish in dhtmlmenu.
I added afield in the db for page_header
Then I went through all the code and I added in the advanced portion of content editing a textarea to handle the page_header.
Then added in the page displaying code the appropriate mysl field calls to get the page_header and add it to the template src.
So now in the advanced tab of content editing you can put the following:
{php} header("Location: p=?reg_thankyou");{/php}
life is good once again.
now I work on making a better menu than the dhtmlmenu.
the css is rubbish in dhtmlmenu.
Pre-Content Header
Very cool. Are you coding against svn, or 0.6.3? I'll be doing database changes for 0.7, so I'd gladly take any patches. I'm hoping to have 0.7rc1 by the end of the week.
Patch - Pre Content Header
I am coding on the downloaded version 6.3 should I be on something else to have latest updates? As I see more things to do I will send them in. At present I am starting to get annoyed with the htmlarea. Would like a preference to not use it. It writes horrible unreadable code. A good html designer / layout person should know their source.
Anywhos,
This patch adds the ability for each content page to have what I call a 'PHP header script'. I usually do things up there like insert into a database, use session variables or call header functions all of which require that this be run before any output to the browser. ergo: before the template even.
You will find that there is a textarea in the 'advanced' section while editing a page. In this section you can place code in there. Ideally this will be something of the following:
Installing the patch:
Step 1.
Add a field to the cms_pages table
'page_header'
'longtext'
Step 2.
Ammend file: admin/editcontent.php with this version:
http://www.hostlounge.be/~rob/cmscs/adm ... ontent.txt
Step 3.
Ammend file: lib/content.functions.php with this version:
http://www.hostlounge.be/~rob/cmscs/lib ... ctions.txt
Here is a diff result of the 2 directories the one downloaded and mine:
http://www.hostlounge.be/~rob/cmscs/diff.txt
Anywhos,
This patch adds the ability for each content page to have what I call a 'PHP header script'. I usually do things up there like insert into a database, use session variables or call header functions all of which require that this be run before any output to the browser. ergo: before the template even.
You will find that there is a textarea in the 'advanced' section while editing a page. In this section you can place code in there. Ideally this will be something of the following:
Code: Select all
{php}
#do some code for checking a form
#do some code for inserting the data into the db
#goto to the congrats page
header( "Location: form_was_good.php" );
{/php}
Step 1.
Add a field to the cms_pages table
'page_header'
'longtext'
Step 2.
Ammend file: admin/editcontent.php with this version:
http://www.hostlounge.be/~rob/cmscs/adm ... ontent.txt
Step 3.
Ammend file: lib/content.functions.php with this version:
http://www.hostlounge.be/~rob/cmscs/lib ... ctions.txt
Here is a diff result of the 2 directories the one downloaded and mine:
http://www.hostlounge.be/~rob/cmscs/diff.txt
Pre-Content Header
Nice idea. I'll make sure to get this in before 0.7rc1, since I'm doing schema changes for this release anyway.
Thanks!
Thanks!
$_POST vars
The above patch works except:
You can not get a hold of the $_POST vars.
Infact you can't do anything with the $_POST vars any in the content, header, template, etc...
I know you can ^do^ something but you have to write a tag or a module.
I just simply want to take the data from a form and put it into a db table.
Any ideas?
Thanks a ton
Rob
You can not get a hold of the $_POST vars.
Infact you can't do anything with the $_POST vars any in the content, header, template, etc...
I know you can ^do^ something but you have to write a tag or a module.
I just simply want to take the data from a form and put it into a db table.
Any ideas?
Thanks a ton
Rob
Pre-Content Header
I'm not really sure where $_POST could be going. It's a super global... I'm going to do some research. I'm wondering if maybe smarty is modifying it in some way.
Re: Solution Pre Content Header
What is wrong with that css?Anonymous wrote:now I work on making a better menu than the dhtmlmenu.
the css is rubbish in dhtmlmenu.
BTW, if you're posting as 'Anonymous', that's fine with me, but I would appreciate it if you would sign your messages with your name, so we all can recognize you. ;)
Cheers,
Leen
Pre-Content Header
I agree with him. The CSS in dhtmlmenu IS rubbish. The problem is that phplayers is including it on it's own file by default. It's hard to override it without first removing the default phplayers one from the file system.
We're trying to work on a solution for this.
We're trying to work on a solution for this.
Sorry for the rant
Sorry for the rant about dhtmlmenu. I am sure that it has some wisdom in it somewhere. Just wasted a few hours trying to change the color to dark blue with no luck eventually I just switched to bullet menu.
$_POST vars
$_POST ofcourse is visible in the index.php
You can put a little thing:
print_r( $_POST ); before the
echo $html;
BUT within the template they are gone gone gone...
If I could access the $_POST and $_GET vars this CMS would be the greatest thign ever. You then would be able to build appz and sites using this cms in a much better way than any ohter CMS out there.
I am reading in the smarty pages as well and I am trying to find it.
I wonder if you turn off caching and just display the pages live if this will bring back the globals.
Rob
You can put a little thing:
print_r( $_POST ); before the
echo $html;
BUT within the template they are gone gone gone...
If I could access the $_POST and $_GET vars this CMS would be the greatest thign ever. You then would be able to build appz and sites using this cms in a much better way than any ohter CMS out there.
I am reading in the smarty pages as well and I am trying to find it.
I wonder if you turn off caching and just display the pages live if this will bring back the globals.
Rob
Pre-Content Header
Well, there is one very easy solution to this problem...
I can just copy the variables in $_GET and $_POST into the $gCms global. Something like: $gCms->variables["post"]["blah"].
That would work, right?
I can just copy the variables in $_GET and $_POST into the $gCms global. Something like: $gCms->variables["post"]["blah"].
That would work, right?
$_POST copying to $gCms
Ok I have this code in the include.php
Then in my page I have this code:
This does not work.
I can access the $_SESSION
However with the smarty caching putting the $_POST into $_SESSION would not be a good thing...
Still trying everything.
This does not work either in the page:
Code: Select all
#attach POST
$gCms->variables["POST"] = $_POST;
Code: Select all
{php}
print_r($gCms->variables);
{/php}
I can access the $_SESSION
However with the smarty caching putting the $_POST into $_SESSION would not be a good thing...
Still trying everything.
This does not work either in the page:
Code: Select all
{php}
echo $gCms->variables["user_id"];
{/php}