Re: Link submission email
Hi Cricket.. Sorry! No i havent tried this Ok so how? and where do i put the above code for this? Thanks again for trying to help, Brook On Apr 20, 11:42 pm, cricket zijn.digi...@gmail.com wrote: Your message is mostly incomprehensible. (For the third time) have you tried debugging either the submitted data or the results of the find? On Wed, Apr 20, 2011 at 6:32 PM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi Cricket, You lost me now, i still have all my normal code how it was before, i havent changed any coding apart from adding to itCODE AS ABOVE, after i added the DB column i did a test submit and the link didnt show up in either the DB or the email i cant understand what needs doing with my code above...I have also just added to the booking form how did you hear about DVV section and this also is not showing up in the email.. What is going on...i still know its something simple but i just cant get my head round it... Am i correct in saying that adding to the form, i would need to change the view (how the form looks) and the controller (how the form works)..?? really confused.. Above in the code i pasted in-- are the views controller that i modified to include the new form sections for the site,,,all i want is for the new sections to show in the email...arr.. Cheers for helping so far. Brook On Apr 20, 5:12 pm, cricket zijn.digi...@gmail.com wrote: Did you ever check to see if it's being submitted? if (!empty($this-data)) { die(debug($this-data)); Also, check after you do the find() $link= $this-Link-findById($this-Link-id); // delete this line later die(debug($link)); $this-set(compact('link')); On Wed, Apr 20, 2011 at 5:15 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi again Cricket, To make helping me easier, ive included below the files what i have now after adding the column to the database...so here go's (THIS IS THE submit_link.ctp) h1?php __('LinkSubmission'); ?/h1 p?php __('Alinkwas submitted on DisneyVillaVacations.com.'); ? ?php __('You can approve/reject thislinkon the website by clicking the followinglink:'); ?/p pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('ReciprocalLink'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table (THIS IS THE links_controller.php) ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('SubmitLink', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories);
Re: Link submission email
Hi Cricket, Sorry if i confused you, im still trying to make peace with cake.lol...I was just asking about option 2, and where i would need to put that code in order for it to work I took option 1: i have added the DB column now, but the reciprocallink is still not showing up in my email...Do i have to alter any other file in- order for it to work correctly with the DB, all i want it to do is show up in the emailim sure ill get there... Thanks again for this assistance, it helps alot. Brook On Apr 20, 4:04 am, cricket zijn.digi...@gmail.com wrote: On Tue, Apr 19, 2011 at 5:25 PM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi Cricket, Thanks for the help, much appreciated... Would option 2 go into the links controller?? I just tried adding the db column, but it didnt show up... but i know why as i changed some code back to how it was, so im sure it should work when i update it...i have updated the DB to include the column reciprocallinkIs it the controller and the view that need updating?? or will i have to update a model as well?? I can't make heads nor tails about what you're asking. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
Hi again Cricket, To make helping me easier, ive included below the files what i have now after adding the column to the database...so here go's (THIS IS THE submit_link.ctp) h1?php __('Link Submission'); ?/h1 p?php __('A link was submitted on DisneyVillaVacations.com.'); ? ?php __('You can approve/reject this link on the website by clicking the following link:'); ?/p pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('Reciprocal Link'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table (THIS IS THE links_controller.php) ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('Submit Link', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories); // Handle form submission if (!empty($this-data)) { // Check CAPTCHA was matched if (!$this-Recaptcha-validate()) { $this-Link-validate['captcha'] = array ( 'rule' = array('comparison', '=', 0), 'message' = 'You did not enter the CAPTCHA correctly.' ); $this-set('captcha_incorrect', true); } // Save and redirect to received message $this-Link-create(); $this-data['Link']['approved'] = 0; if ($this-Link-save($this-data)) { // Send email to admin $this-set('link', $this-Link-findById($this-Link- id)); $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com - Link Submission', true); $this-Email-template = 'submit_link'; $this-Email-sendAs = 'both'; $this-Email-send(); // Redirect back $this-Session-setFlash('Your link has been submitted, and is awaiting approval.'); $this-redirect(array('action' = 'index')); } } } (THIS IS THE submit.ctp) h2?php __('Submit Link'); ?/h2 p?php __('If you would like to add your website to our links, please fill in the form below.'); ? ?php __('Please note that links are moderated and must be approved before they appear on the website.'); ?/p ?php echo $form-create('Link', array('action' = 'submit')); ? ?php echo $form-inputs(array ( 'legend' = false, 'Link.link_category_id' = array ( 'label' = __('Category', true) ), 'Link.title', 'Link.url' = array( 'label' = __('URL', true) ), 'Link.description',
Re: Link submission email
Hi again Cricket, To make helping me easier, ive included below the files what i have now after adding the column to the database...so here go's (THIS IS THE submit_link.ctp) h1?php __('Link Submission'); ?/h1 p?php __('A link was submitted on DisneyVillaVacations.com.'); ? ?php __('You can approve/reject this link on the website by clicking the following link:'); ?/p pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('Reciprocal Link'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table (THIS IS THE links_controller.php) ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('Submit Link', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories); // Handle form submission if (!empty($this-data)) { // Check CAPTCHA was matched if (!$this-Recaptcha-validate()) { $this-Link-validate['captcha'] = array ( 'rule' = array('comparison', '=', 0), 'message' = 'You did not enter the CAPTCHA correctly.' ); $this-set('captcha_incorrect', true); } // Save and redirect to received message $this-Link-create(); $this-data['Link']['approved'] = 0; if ($this-Link-save($this-data)) { // Send email to admin $this-set('link', $this-Link-findById($this-Link- id)); $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com - Link Submission', true); $this-Email-template = 'submit_link'; $this-Email-sendAs = 'both'; $this-Email-send(); // Redirect back $this-Session-setFlash('Your link has been submitted, and is awaiting approval.'); $this-redirect(array('action' = 'index')); } } } (THIS IS THE submit.ctp) h2?php __('Submit Link'); ?/h2 p?php __('If you would like to add your website to our links, please fill in the form below.'); ? ?php __('Please note that links are moderated and must be approved before they appear on the website.'); ?/p ?php echo $form-create('Link', array('action' = 'submit')); ? ?php echo $form-inputs(array ( 'legend' = false, 'Link.link_category_id' = array ( 'label' = __('Category', true) ), 'Link.title', 'Link.url' = array( 'label' = __('URL', true) ), 'Link.description',
Re: Link submission email
Did you ever check to see if it's being submitted? if (!empty($this-data)) { die(debug($this-data)); Also, check after you do the find() $link = $this-Link-findById($this-Link-id); // delete this line later die(debug($link)); $this-set(compact('link')); On Wed, Apr 20, 2011 at 5:15 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi again Cricket, To make helping me easier, ive included below the files what i have now after adding the column to the database...so here go's (THIS IS THE submit_link.ctp) h1?php __('Link Submission'); ?/h1 p?php __('A link was submitted on DisneyVillaVacations.com.'); ? ?php __('You can approve/reject this link on the website by clicking the following link:'); ?/p pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('Reciprocal Link'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table (THIS IS THE links_controller.php) ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('Submit Link', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories); // Handle form submission if (!empty($this-data)) { // Check CAPTCHA was matched if (!$this-Recaptcha-validate()) { $this-Link-validate['captcha'] = array ( 'rule' = array('comparison', '=', 0), 'message' = 'You did not enter the CAPTCHA correctly.' ); $this-set('captcha_incorrect', true); } // Save and redirect to received message $this-Link-create(); $this-data['Link']['approved'] = 0; if ($this-Link-save($this-data)) { // Send email to admin $this-set('link', $this-Link-findById($this-Link- id)); $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com - Link Submission', true); $this-Email-template = 'submit_link'; $this-Email-sendAs = 'both'; $this-Email-send(); // Redirect back $this-Session-setFlash('Your link has been submitted, and is awaiting approval.'); $this-redirect(array('action' = 'index')); } } } (THIS IS THE submit.ctp) h2?php __('Submit Link'); ?/h2 p?php __('If you would like to add your website to our links, please fill in the form below.'); ? ?php __('Please note that links are moderated and must be approved before they appear on the
Re: Link submission email
Hi Cricket, You lost me now, i still have all my normal code how it was before, i havent changed any coding apart from adding to itCODE AS ABOVE, after i added the DB column i did a test submit and the link didnt show up in either the DB or the email i cant understand what needs doing with my code above...I have also just added to the booking form how did you hear about DVV section and this also is not showing up in the email.. What is going on...i still know its something simple but i just cant get my head round it... Am i correct in saying that adding to the form, i would need to change the view (how the form looks) and the controller (how the form works)..?? really confused.. Above in the code i pasted in-- are the views controller that i modified to include the new form sections for the site,,,all i want is for the new sections to show in the email...arr.. Cheers for helping so far. Brook On Apr 20, 5:12 pm, cricket zijn.digi...@gmail.com wrote: Did you ever check to see if it's being submitted? if (!empty($this-data)) { die(debug($this-data)); Also, check after you do the find() $link= $this-Link-findById($this-Link-id); // delete this line later die(debug($link)); $this-set(compact('link')); On Wed, Apr 20, 2011 at 5:15 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi again Cricket, To make helping me easier, ive included below the files what i have now after adding the column to the database...so here go's (THIS IS THE submit_link.ctp) h1?php __('LinkSubmission'); ?/h1 p?php __('Alinkwas submitted on DisneyVillaVacations.com.'); ? ?php __('You can approve/reject thislinkon the website by clicking the followinglink:'); ?/p pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('ReciprocalLink'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table (THIS IS THE links_controller.php) ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('SubmitLink', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories); // Handle formsubmission if (!empty($this-data)) { // Check CAPTCHA was matched if (!$this-Recaptcha-validate()) { $this-Link-validate['captcha'] = array ( 'rule' = array('comparison', '=', 0), 'message' = 'You did not enter the CAPTCHA correctly.' ); $this-set('captcha_incorrect', true); } // Save and redirect to received message $this-Link-create();
Re: Link submission email
Your message is mostly incomprehensible. (For the third time) have you tried debugging either the submitted data or the results of the find? On Wed, Apr 20, 2011 at 6:32 PM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi Cricket, You lost me now, i still have all my normal code how it was before, i havent changed any coding apart from adding to itCODE AS ABOVE, after i added the DB column i did a test submit and the link didnt show up in either the DB or the email i cant understand what needs doing with my code above...I have also just added to the booking form how did you hear about DVV section and this also is not showing up in the email.. What is going on...i still know its something simple but i just cant get my head round it... Am i correct in saying that adding to the form, i would need to change the view (how the form looks) and the controller (how the form works)..?? really confused.. Above in the code i pasted in-- are the views controller that i modified to include the new form sections for the site,,,all i want is for the new sections to show in the email...arr.. Cheers for helping so far. Brook On Apr 20, 5:12 pm, cricket zijn.digi...@gmail.com wrote: Did you ever check to see if it's being submitted? if (!empty($this-data)) { die(debug($this-data)); Also, check after you do the find() $link= $this-Link-findById($this-Link-id); // delete this line later die(debug($link)); $this-set(compact('link')); On Wed, Apr 20, 2011 at 5:15 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi again Cricket, To make helping me easier, ive included below the files what i have now after adding the column to the database...so here go's (THIS IS THE submit_link.ctp) h1?php __('LinkSubmission'); ?/h1 p?php __('Alinkwas submitted on DisneyVillaVacations.com.'); ? ?php __('You can approve/reject thislinkon the website by clicking the followinglink:'); ?/p pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('ReciprocalLink'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table (THIS IS THE links_controller.php) ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('SubmitLink', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories); // Handle formsubmission if (!empty($this-data)) { // Check CAPTCHA was matched if (!$this-Recaptcha-validate()) { $this-Link-validate['captcha'] = array ( 'rule' = array('comparison', '=', 0), 'message' = 'You did not
Re: Link submission email
Hi Cricket, HAHAHAHAH! i told you i was fairly new, im trying to come to terms with cakephpAND I DIDNT create a DB column for reciprocallink LOL!...So is this all im missing, the DB column? and then it should work right yes? Thanks again for helping, much appreciated. On Apr 19, 12:36 am, cricket zijn.digi...@gmail.com wrote: On Mon, Apr 18, 2011 at 4:14 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Yeah ok sorry about that...heres my submitlink.ctp which is the emaili get. I have left the bottom part of the controller as i know this is for admin purposesHOPE YOU CAN HELP,cause ive been looking and cant seem to find anything wrong, but saying that im still fairly new to cakeCheers for the assistance. pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('ReciprocalLink'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table HERES MY view ?php echo $form-create('Link', array('action' = 'submit')); ? ?php echo $form-inputs(array ( 'legend' = false, 'Link.link_category_id' = array ( 'label' = __('Category', true) ), 'Link.title', 'Link.url' = array( 'label' = __('URL', true) ), 'Link.description', 'Link.reciprocallink' )); ? Have you checked the DB to see if 'reciprocallink' is empty? Try also debugging the submitted data. if (!empty($this-data)) { die(debug($this-data)); Actually, are you sure the DB column isn't named 'reciprocal_link'? AND HERES MY controller ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); You don't need LinkCategory here because you can access it throughLink: $this-Link-LinkCategory-find(...) Better yet, put this in theLinkmodel: public function getCategories($order = array()) { if (empty($order)) { $order = array('Linkcategory.title' = 'ASC'); } return $this-LinkCategory-find( 'list', array( 'order' = $order ) ); } controller: public function submit() { if (!empty($this-data)) { // ... } $this-set( 'categories', $this-Link-getCategories() ); } You should fetch the categories after checking if $this-data is empty. If thesubmissionsucceeds you redirect, so there's no need to get the categories. If it fails, execution falls through, you get the categories, and show the form again. But you should add an else to set a flash message (but don't redirect) if save fails. $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com -LinkSubmission', true); $this-Email-from = Configure::read('Email.from_name'). ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = Configure::read('Email.subject'); bootstrap: Configure::write('Email.from_name', 'DisneyVillaVacations.com'); Configure::write('Email.subject', 'DisneyVillaVacations.com');- Hide quoted text - - Show quoted text - -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
DAM!!...Scrap that last note: Just been checking the DB and theres is nothing for the forms, and i just thought whilst looking...i dont need to store the Reciprocal Link i just need it to show up in the emailNow im really confused...PLEASE HELP!! Cheers Cricket for helping with this. On Apr 19, 8:48 am, dvvbrook79 c...@disneyvillavacations.com wrote: Hi Cricket, HAHAHAHAH! i told you i was fairly new, im trying to come to terms with cakephpAND I DIDNT create a DB column for reciprocallink LOL!...So is this all im missing, the DB column? and then it should work right yes? Thanks again for helping, much appreciated. On Apr 19, 12:36 am, cricket zijn.digi...@gmail.com wrote: On Mon, Apr 18, 2011 at 4:14 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Yeah ok sorry about that...heres my submitlink.ctp which is the emaili get. I have left the bottom part of the controller as i know this is for admin purposesHOPE YOU CAN HELP,cause ive been looking and cant seem to find anything wrong, but saying that im still fairly new to cakeCheers for the assistance. pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('ReciprocalLink'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table HERES MY view ?php echo $form-create('Link', array('action' = 'submit')); ? ?php echo $form-inputs(array ( 'legend' = false, 'Link.link_category_id' = array ( 'label' = __('Category', true) ), 'Link.title', 'Link.url' = array( 'label' = __('URL', true) ), 'Link.description', 'Link.reciprocallink' )); ? Have you checked the DB to see if 'reciprocallink' is empty? Try also debugging the submitted data. if (!empty($this-data)) { die(debug($this-data)); Actually, are you sure the DB column isn't named 'reciprocal_link'? AND HERES MY controller ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); You don't need LinkCategory here because you can access it throughLink: $this-Link-LinkCategory-find(...) Better yet, put this in theLinkmodel: public function getCategories($order = array()) { if (empty($order)) { $order = array('Linkcategory.title' = 'ASC'); } return $this-LinkCategory-find( 'list', array( 'order' = $order ) ); } controller: public function submit() { if (!empty($this-data)) { // ... } $this-set( 'categories', $this-Link-getCategories() ); } You should fetch the categories after checking if $this-data is empty. If thesubmissionsucceeds you redirect, so there's no need to get the categories. If it fails, execution falls through, you get the categories, and show the form again. But you should add an else to set a flash message (but don't redirect) if save fails. $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com -LinkSubmission', true); $this-Email-from = Configure::read('Email.from_name'). ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = Configure::read('Email.subject'); bootstrap: Configure::write('Email.from_name', 'DisneyVillaVacations.com'); Configure::write('Email.subject', 'DisneyVillaVacations.com');- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
On Tue, Apr 19, 2011 at 4:11 AM, dvvbrook79 c...@disneyvillavacations.com wrote: DAM!!...Scrap that last note: Just been checking the DB and theres is nothing for the forms, and i just thought whilst looking...i dont need to store the Reciprocal Link i just need it to show up in the emailNow im really confused...PLEASE HELP!! If there's no column for reciprocallink in the DB, when you save the Link, that information will be ignored. You problem is that you're saving the submitted data, then fetching it from the DB to create a view var named $link. You're then trying to access reciprocallink from the $link var. But, of course, there being no reciprocallink column in the DB, $link will not contain it. So you have two options. 1: Create the column in the DB table. The reciprocallink will be stored and will also appear in $link for your view. 2: Set a separate view var for reciprocallink. $this-set( 'link', $this-Link-findById($this-Link-id) ); $this-set( 'reciprocallink' $reciprocallink ); view: td?php echo $reciprocallink; ?/td I think 1 is the simplest solution and makes most sense. If you're going to store Link it may as well include reciprocallink. However, it's unclear to me why you're doing an extra find immediately after saving. Unless you have some need for the ID (it doesn't appear so) or one or more fields are altered in a beforeSave or afterSave calback in the Link model, there's no need to call find() after saving. You could just do something like this: function submit() { if (!empty($this-data)) { // do CAPTCHA validation ... $this-Link-create(); $this-data['Link']['approved'] = 0; $this-Link-set($this-data); if ($this-Link-validates()) { // validation ok, try to save if ($this-Link-save($this-data)) { $this-set( 'link', $this-data['Link'] ); // send email } else { // save failed, set flash msg } } else { // validation failed, set flash msg } } $this-set( 'categories', $this-Link-getCategories() ); } view: td?php echo $link['title']; ?/td ... td?php echo $link['description']; ?/td ... td?php echo $link['reciprocallink']; ?/td Notice that you don't need to include ['Link'] in the view because $link was set from $this-data['Link'], not $this-data. You should also do $this-Link-set($this-data), then perform validation, setting flash messages as needed. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
Hi Cricket, Thanks for the help, much appreciated... Would option 2 go into the links controller?? I just tried adding the db column, but it didnt show up... but i know why as i changed some code back to how it was, so im sure it should work when i update it...i have updated the DB to include the column reciprocallinkIs it the controller and the view that need updating?? or will i have to update a model as well?? Thanks again for helping... Brook On Apr 19, 7:47 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Apr 19, 2011 at 4:11 AM, dvvbrook79 c...@disneyvillavacations.com wrote: DAM!!...Scrap that last note: Just been checking the DB and theres is nothing for the forms, and i just thought whilst looking...i dont need to store the Reciprocal Link i just need it to show up in theemailNow im really confused...PLEASE HELP!! If there's no column for reciprocallink in the DB, when you save theLink, that information will be ignored. You problem is that you're saving the submitted data, then fetching it from the DB to create a view var named $link. You're then trying to access reciprocallink from the $linkvar. But, of course, there being no reciprocallink column in the DB, $linkwill not contain it. So you have two options. 1: Create the column in the DB table. The reciprocallink will be stored and will also appear in $linkfor your view. 2: Set a separate view var for reciprocallink. $this-set( 'link', $this-Link-findById($this-Link-id) ); $this-set( 'reciprocallink' $reciprocallink ); view: td?php echo $reciprocallink; ?/td I think 1 is the simplest solution and makes most sense. If you're going to storeLinkit may as well include reciprocallink. However, it's unclear to me why you're doing an extra find immediately after saving. Unless you have some need for the ID (it doesn't appear so) or one or more fields are altered in a beforeSave or afterSave calback in theLinkmodel, there's no need to call find() after saving. You could just do something like this: function submit() { if (!empty($this-data)) { // do CAPTCHA validation ... $this-Link-create(); $this-data['Link']['approved'] = 0; $this-Link-set($this-data); if ($this-Link-validates()) { // validation ok, try to save if ($this-Link-save($this-data)) { $this-set( 'link', $this-data['Link'] ); // sendemail } else { // save failed, set flash msg } } else { // validation failed, set flash msg } } $this-set( 'categories', $this-Link-getCategories() ); } view: td?php echo $link['title']; ?/td ... td?php echo $link['description']; ?/td ... td?php echo $link['reciprocallink']; ?/td Notice that you don't need to include ['Link'] in the view because $linkwas set from $this-data['Link'], not $this-data. You should also do $this-Link-set($this-data), then perform validation, setting flash messages as needed. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
On Tue, Apr 19, 2011 at 5:25 PM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi Cricket, Thanks for the help, much appreciated... Would option 2 go into the links controller?? I just tried adding the db column, but it didnt show up... but i know why as i changed some code back to how it was, so im sure it should work when i update it...i have updated the DB to include the column reciprocallinkIs it the controller and the view that need updating?? or will i have to update a model as well?? I can't make heads nor tails about what you're asking. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
Yeah ok sorry about that...heres my submitlink.ctp which is the email i get. I have left the bottom part of the controller as i know this is for admin purposesHOPE YOU CAN HELP,cause ive been looking and cant seem to find anything wrong, but saying that im still fairly new to cakeCheers for the assistance. pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('Reciprocal Link'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table HERES MY view ?php echo $form-create('Link', array('action' = 'submit')); ? ?php echo $form-inputs(array ( 'legend' = false, 'Link.link_category_id' = array ( 'label' = __('Category', true) ), 'Link.title', 'Link.url' = array( 'label' = __('URL', true) ), 'Link.description', 'Link.reciprocallink' )); ? ?php if (isset($captcha_incorrect)): ? p?php __('You have entered the CAPTCHA incorrectly. Please try again.'); ?/p ?php else: ? p?php __('Please enter the words you see below:'); ?/p ?php endif; ? ?php echo $recaptcha-show(); ? ?php echo $form-end(__('Submit Link', true)); ? AND HERES MY controller ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); var $helpers = array('Recaptcha'); var $components = array('Email', 'Recaptcha'); var $paginate = array ( 'limit' = 15, 'page' = 1, 'order' = array ('Link.created' = 'ASC'), 'conditions' = array ('Link.approved' = 1) ); function beforeFilter() { // Set up authentication parent::beforeFilter(); // Allow access to public functions $this-Auth-allowedActions = array( 'index', 'category', 'submit' ); } function index() { // Get community page content $page = $this-Page-find('first', array('conditions' = array ('slug' = 'links'))); $this-set('page', $page); $this-set('title_for_layout', $page['Page']['title']); // Display all categories $link_categories = $this-LinkCategory-find('all'); $this-set('link_categories', $link_categories); } function category($slug) { // Find Category $link_category = $this-LinkCategory-findBySlug($slug); $this-set('link_category', $link_category); // Find Links in Category $this-set('links', $this-paginate($this-LinkCategory-Link, array ('Link.link_category_id' = $link_category['LinkCategory'] ['id']))); // Title $this-set('title_for_layout', $link_category['LinkCategory'] ['title']); } function submit() { // Title $this-set('title_for_layout', __('Submit Link', true)); // Load category list $link_categories = $this-Link-LinkCategory-find('list', array ( 'order' = 'LinkCategory.title' )); $this-set('linkCategories', $link_categories); // Handle form submission if (!empty($this-data)) { // Check CAPTCHA was matched if (!$this-Recaptcha-validate()) { $this-Link-validate['captcha'] = array ( 'rule' = array('comparison', '=', 0), 'message' = 'You did not enter the CAPTCHA correctly.' ); $this-set('captcha_incorrect', true); } // Save and redirect to received message $this-Link-create(); $this-data['Link']['approved'] = 0; if ($this-Link-save($this-data)) { // Send email to admin $this-set('link', $this-Link-findById($this-Link- id)); $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com - Link Submission', true); $this-Email-template = 'submit_link'; $this-Email-sendAs = 'both'; $this-Email-send(); // Redirect back $this-Session-setFlash('Your link has been submitted, and is awaiting approval.'); $this-redirect(array('action' = 'index'));
Re: Link submission email
On Mon, Apr 18, 2011 at 4:14 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Yeah ok sorry about that...heres my submitlink.ctp which is the email i get. I have left the bottom part of the controller as i know this is for admin purposesHOPE YOU CAN HELP,cause ive been looking and cant seem to find anything wrong, but saying that im still fairly new to cakeCheers for the assistance. pa href=?php echo $html-url(array('controller' = 'links', 'action' = 'submissions', 'admin' = true), true); ??php __('Link Submissions'); ?/a/p table tr td?php __('Category'); ?:/td td?php echo $link['LinkCategory']['title']; ?/td /tr tr td?php __('Title'); ?:/td td?php echo $link['Link']['title']; ?/td /tr tr td?php __('URL'); ?:/td td?php echo $html-link($link['Link']['url'], $link['Link'] ['url']); ?/td /tr tr td?php __('Description'); ?:/td td?php echo $link['Link']['description']; ?/td /tr tr td?php __('Reciprocal Link'); ?:/td td?php echo $link['Link']['reciprocallink']; ?/td /tr /table HERES MY view ?php echo $form-create('Link', array('action' = 'submit')); ? ?php echo $form-inputs(array ( 'legend' = false, 'Link.link_category_id' = array ( 'label' = __('Category', true) ), 'Link.title', 'Link.url' = array( 'label' = __('URL', true) ), 'Link.description', 'Link.reciprocallink' )); ? Have you checked the DB to see if 'reciprocallink' is empty? Try also debugging the submitted data. if (!empty($this-data)) { die(debug($this-data)); Actually, are you sure the DB column isn't named 'reciprocal_link'? AND HERES MY controller ?php class LinksController extends AppController { var $name = 'Links'; var $uses = array('Link', 'LinkCategory', 'Page'); You don't need LinkCategory here because you can access it through Link: $this-Link-LinkCategory-find(...) Better yet, put this in the Link model: public function getCategories($order = array()) { if (empty($order)) { $order = array('Linkcategory.title' = 'ASC'); } return $this-LinkCategory-find( 'list', array( 'order' = $order ) ); } controller: public function submit() { if (!empty($this-data)) { // ... } $this-set( 'categories', $this-Link-getCategories() ); } You should fetch the categories after checking if $this-data is empty. If the submission succeeds you redirect, so there's no need to get the categories. If it fails, execution falls through, you get the categories, and show the form again. But you should add an else to set a flash message (but don't redirect) if save fails. $this-Email-from = __('DisneyVillaVacations.com', true) . ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = __('DisneyVillaVacations.com - Link Submission', true); $this-Email-from = Configure::read('Email.from_name'). ' ' . Configure::read('Admin.email') . ''; $this-Email-to = Configure::read('Admin.email'); $this-Email-subject = Configure::read('Email.subject'); bootstrap: Configure::write('Email.from_name', 'DisneyVillaVacations.com'); Configure::write('Email.subject', 'DisneyVillaVacations.com'); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Link submission email
On Sun, Apr 17, 2011 at 9:17 AM, dvvbrook79 c...@disneyvillavacations.com wrote: Hi I have a link submission page, and have just added a reciprocal link field...which worked fine, however i cant get to draw this information out of the field into the email that is sent to me when i have a link submittedit ends up like this.. URL: http://www.example.com Title: example Description: Example example.etc Reciprocal Link: blank (this is the info im trying to get from the new field) Can anyone point me in the right direction. There's no way anyone could spot the problem without seeing the email template as well as the controller code to see what variables you're setting for the view (and how you're setting them). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php