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
<[email protected]> 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>
>
> <p><a 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',
> '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)); ?>
>
>
> Further to my last email, i have now added the DB column but
> "reciprocallink" still not showing up in the email....Hope this makes
> it easier,,,
>
> Cheers again for helping..
>
> Brook
>
>
> On Apr 20, 4:04 am, cricket <[email protected]> wrote:
>> On Tue, Apr 19, 2011 at 5:25 PM, dvvbrook79
>>
>> <[email protected]> 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
>> > "reciprocallink"....Is 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
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
>
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php