You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I am writing a new module for my site and I am using existing CCP code to help me, but I cannot understand how this works.
Below is a typical CCP <INPUT> field that works:
<INPUT TYPE="HIDDEN" NAME="pg" VALUE="">
<br>First Name:<INPUT TYPE="TEXT" NAME="" SIZE="20" VALUE="">
What I cannot understand is that the called subroutine "ste_mail_maillist_proc" always refers to the field as "fd_tracking_firstname" rather than just "tracking_firstname".
Now this works, so I assume the "fd_" part is set somewhere, but I can't for the good of me tell where.
The reason I ask is that my new module is using a new variables in the <INPUT> tag (e.g. "dog_name") and when I evaluate them in my subroutine, it is always blank. I have tried just "dog_name" and "fd_dog_name".
Offline
Perhaps I could explain this better:
Where is the ccp URL parsed to strip out the variables?
.. and if I introduce new <FORM> variables, do I need to declare these somewhere ?
Offline
The 'fd_' variables are set in the ste_usr.pl file and are available only for fields pertaining to users (billing & shipping info). What exactly are you trying to do?
Offline
Thanks Nick, I have added a new form and want to the pass the form variables back to a new perl module I have created.
This module inserts the form data into a new table.
Offline
Create a process routine (ste_mynewcode_proc) in ./cgi-bin/library/modules/ste_mynewcode.pl and pick up on the formdata and process with your module. Then, redirect to a confirm page. Use the ste_mail.pl file as an example.
Or, use the Dynamic Form functionality in CCP.
Offline
Thanks Nick,
For anyone else doing this, these are the notes I have compiled:
All calls to CCP are handled through either the cp-app.pl or cp-admin.pl. Focusing on the cp-app.pl, this perl script calls initialize.pl to set up all the variables, initialize.pl then calls ste_exec.pl whose job it is to determine which page to display next. It check for pages in this order:
- is it a dynamic page by looking in the dynform.csv (e.g. the trade enquires form is of this type)
- is it a system page by looking in the syspage.csv table (most pages requests are of this type, ie. product displays etc)
- is it an HTML page by looking in htmlpage.csv (e.g store policies)
- if it is none of the above the splash page is assummed
ste_exec.pl then (using the display_print sub) displays the ste_layout element in all cases. Within ste_layout, the main content section is called using the folllowing (CGIGET TYPE="SUB" VALUE="ste_exec_element" PARAMS="(CGIVAR)element_id(/CGIVAR)"). The subroutine ste_exec_element exists within ste_exec.pl
1. Adding new programmes
Subroutines within .pl files can be called within elements by either:
eg.1 (CGIGET TYPE="SUB" VALUE="ste_community_splash") which is mainly used to display parts of a page
eg.2 within forms
<FORM METHOD="POST" ACTION="(CGIVAR)common_url_form(/CGIVAR)"> (CGIVAR)common_hidden_fields(/CGIVAR) <INPUT TYPE="TEXT" NAME="tracking_firstname" VALUE="(CGIVAR)fd_tracking_firstname(/CGIVAR)"> <INPUT TYPE="TEXT" NAME="tracking_lastname" VALUE="(CGIVAR)fd_tracking_lastname(/CGIVAR)"> <INPUT TYPE="TEXT" NAME="tracking_email" VALUE="(CGIVAR)fd_tracking_email(/CGIVAR)"> <INPUT TYPE="HIDDEN" NAME="pg" VALUE="ste_community_add_mem_proc"> <INPUT TYPE="IMAGE" SRC="(CGIVAR)images_path(/CGIVAR)/button/submit_submit.gif" WIDTH="(CGIVAR)site_button_image_width(/CGIVAR)" HEIGHT="(CGIVAR)site_button_image_height(/CGIVAR)" BORDER="0" VALUE="submit"> <A HREF="(CGIVAR)common_url(/CGIVAR)&pg=cancel"><IMG SRC="(CGIVAR)images_path(/CGIVAR)/button/submit_cancel.gif" WIDTH="(CGIVAR)site_button_image_width(/CGIVAR)" HEIGHT="(CGIVAR)site_button_image_height(/CGIVAR)" BORDER="0"></A> </FORM>
The when calling subroutines within forms, the subroutine name must start with the file name of the programe (e.g. a subroutine in ste_community.pl must be name "ste_cummunity......" so the CCP knows where to find it.
Adding new pages to CCP involves the following:
1. Create a new element to contain the contents of the page
2. add an entry to the syspage.csv (or htmlpage.csv) file to represent the new screen
3. Within the element, if PERL processing is required, the element should contain a reference to the perl script in the manner:
(CGIGET TYPE="SUB" VALUE="ste_community_splash") - where the 'ste_community_' part is the name of the perl script.
example: $dir_name = $q->param('dir_name');
Offline