On Mon, Apr 18, 2011 at 4:14 AM, dvvbrook79
<[email protected]> 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 purposes....HOPE YOU CAN HELP,cause ive been looking
> and cant seem to find anything wrong, but saying that im still fairly
> new to cake....Cheers for the assistance.
>
>
> <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>
>
> "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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php