//post.thtml
<div id="ajax_update">
<table cellpadding='0' cellspacing='0' border='0'>
<?php echo $html->formTag('/blogs/viewPost/' , 'get'); ?>
<tr height='24'><td>Title:</td><td><input type="text" name="post_title"
size="50" /></td></tr>
<tr height='24'><td>URL:</td><td><input type="text" name="post_url"
size="45" maxlength = "255" /></td></tr>
</table>
<?php
        if ($paging['style'] == 'html')
                echo $html->submit('Submit');
        else
                echo $ajax->submit('Submit', array('url' => 'viewPost',
'update'=>'ajax_update', 'loading' => "Element.show('".
$pagination->domId ."');", 'complete' =>
"Element.hide('".$pagination->domId ."');", 'method' =>'get'));
?></td>

<?php $pagination->domId = 'loading';?>
<div id="loading" style="display:none;float:right;"><?php echo
$html->image('xppc/spinner.gif',array('align'=>'texttop'))?></div>
        <?php
        foreach ($report_data as $data)
        ?>
        <div class="task" id="done_<?php echo $data['Post']['id']; ?>">
        <table cellpadding='0' cellspacing='0' border='0'>
        <tr height='24'><td>Title:</td><td><?php echo $data['Post']['title']
?></td></tr>
        <tr height='24'><td>Description:</td><td><?php echo
$data['Post']['description'] ?></td>
        <tr height='24'><td>URL:</td><td><?php echo
$html->link($data['Post']['url'], $data['Post']['url']);?></td></tr>
        <tr><td>
                <?php
                        if ($pagination->style == 'ajax')
                                echo $ajax->link('Delete Post', 
'/blogs/deletePost/' .
$data['Post']['id'], array('update'=>'ajax_update', 'after' => 'new
Effect.Fade(\'done_' . $data['Post']['id'] . '\');'));
                        else
                                echo $html->link('Delete Post', 
'/blogs/deletePost/' .
$data['Post']['id']);
        ?></td></tr></table>
        </div>
        <?php
        endforeach;
        ?>
</div>

//Controller: blogs


                        function deletePost($id=null)
                        {
                                //PostID ($id) is invalid.
                                if (empty($this->params['form']))
                                {
                                        $this->Post->id= $id ;
                                        $data = 
$this->Post->find($criteria="account_id='" . $account_id .
"' and Post.id = '" . $id . "'");
                                        $this->set('data', $data);
                                        $this->set('id', $id);
                                        $this->render();
                                }
                                else
                                {
                                        if 
(!empty($this->params['form']['cancel']))
                                        {
                                                
$this->redirect('/blogs/viewPost/');
                                        }
                                        else
                                        {
                                                _deletePost($id);
                                                
$this->redirect('/blogs/viewPost/');
                                        }
                                }
                        }
                        function _deletePost($id=null)
                        {
                                        $this->Post->id= $id ;
                                        $data = 
$this->Post->find($criteria="account_id='" . $account_id .
"' and Post.id = '" . $id . "'");
                                if (!empty($data))
                                {
                                        $this->Post->del($id);
                                        $this->Comment->query("delete from 
keywords where post_id = '" .
$id . "'");
                                        return true;
                                }
                                else
                                {
                                        return false;
                                }
                        }




//things i've tried:
if($this->RequestHandler->isAjax())
{
        $this->autoRender=false;
}
//things i've tried:
if($this->RequestHandler->isAjax())
{
                $this->layout="ajax";
}
// Can you show me where either one of those two go in the above code
or is there a different way to make this baby work ?

Thank you.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to