Sunday, March 31, 2013

Re: PDF & Excel generation in CakePHP 2.0

Hi Rusty.
Recently my project reports produced through the excelphp now tried to implement TCPDF
without removing excelphp. Now when I try to produce the same reports in excelphp get this
message: "Excel can not open the file because the file formt file_name.xlsx or file extension
is not valid. The Verify that the file has not Been corrupted and the file extension matches the
format of the file "
Can i use Excelphp and tcpdf at the same time
can you help me fix the error

On Friday, March 16, 2012 6:36:20 AM UTC+2, konda wrote:
Thanks to all.

I want to generate reports using PDF and Excel format. Please help me
how can I achieve this.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Use Excelphp and tcpdf in project

Hi!
Recently my project reports produced through the excelphp now tried to implement TCPDF
without removing excelphp. Now when I try to produce the same reports in excelphp get this
message: "Excel can not open the file because the file formt file_name.xlsx or file extension
is not valid. The Verify that the file has not Been corrupted and the file extension matches the
format of the file "
Can i use Excelphp and tcpdf at the same time
can someone tell how can i fix the error

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: The request has been black-holed



On Thursday, March 28, 2013 4:57:38 PM UTC+7, b...@articad.cc wrote:
Security features like this that cause issues with basic flow, should be OFF by default. CakePHP is it's own worst enemy for leaving it in.


Why do you think CakePHP turns SecurityComponent on by default?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: How can I keep a user logged in longer?

if its just keeping people logged in (via a "remember me" checkbox), then writing a simple bit of cookie code which encrypts the user/pass in a cookie and decrypts and attempts to login before the auth component takes over would be one way.

There are such plugins available - heres one:
http://milesj.me/code/cakephp/auto-login


On Mon, Apr 1, 2013 at 12:57 PM, Shahruk Khan <shahruksemail@gmail.com> wrote:
Right now users get logged out on a daily basis. I am using the table cake_sessions to store user sessions. How can I increase the logout time to say a month or so?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

How can I keep a user logged in longer?

Right now users get logged out on a daily basis. I am using the table cake_sessions to store user sessions. How can I increase the logout time to say a month or so?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

cakephp.org still down?

Any updates as to when it might be back up?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Saturday, March 30, 2013

Re: New to CakePHP

look into /app/config/bootstrap.php file 
you should have settings something like: 

 Configure::write('Site.contact_email', 'whatever@your_site.com');
 Configure::write('Site.contact_email_subject', 'some subject'); 


On Wednesday, March 27, 2013 10:32:48 AM UTC-7, Ellie Quick wrote:
Help,

Im a fairly experienced php coder however Ive been given access to a site (as the author is no longer contactable) written using CakePHP and Im totally and utterly lost as to how to make the fairly urgently required fixes.

Theres a contact form on one of the pages which doesnt work, no error messages to say whats wrong, Its meant to send an email to the site owner but nothing is ever received. Now this could be as simple as the wrong email address being used through to there simply being no back end code for sending the mail.

ive found a file called "contacts_controller.php" which contains an email function which is clearly designed to send the relevant emails however the bit thats losing me is:

$email_to = Configure::read('Site.contact_email');
$email_subject = Configure::read('Site.contact_email_subject');
$email_from = Configure::read('Site.contact_email_from');

I cant find anywhere, either in the site server files or the relevant database anything that appears to hold these variables.

Am I being dim?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Cake Gallery

this is how I upload images and create thumbs in any sizes without any plugin,... of course you have to modify to your own needs,... don't forget to create subdirectories in webroot/photos/ original,... thumbs,... etc,... and chmod to 777

function upload in photos_controller: 


  function upload()
  {
    $this->authorize();
    
    $user = $this->User->findById($this->user['id']);
   

    if(!($user && ($user['User']['photos_limit'] == 0 || $user['User']['photos'] < $user['User']['photos_limit'])))
    {
exit('You reached your upload limit');
    }
    else
    {
      $fileParts = $_FILES['Filedata']['name'];
      $secret = $this->generateRandomString(20);
      $name = str_replace(array('.jpg', '.jpeg', '.JPG', '.JPEG', '.png', '.PNG'), '', $fileParts);

      if($this->Photo->save(array('Photo' => array('name' => $name, 'user_id' => $this->user['id'], 'secret' => $secret, 'hidden' => 0, 'privacy' => array_search($_GET['privacy'], Configure::read('Site.privacy'))))))
      { 
        $this->User->query('UPDATE fociki_users' .
        ' SET photos = photos + 1' .
        ', last_public_photo = (SELECT created FROM fociki_photos WHERE user_id = ' . $this->user['id'] . ' AND fociki_photos.privacy <= ' . array_search('public', Configure::read('Site.privacy')) .' ORDER BY created DESC LIMIT 1)' .
        ', last_friend_photo = (SELECT created FROM fociki_photos WHERE user_id = ' . $this->user['id'] . ' AND fociki_photos.privacy <= ' . array_search('friend', Configure::read('Site.privacy')) .' ORDER BY created DESC LIMIT 1)' .
        ' WHERE id = ' . $this->user['id']);


        $original_file = $this->Photo->getOriginalFile($this->Photo->id, $secret, true);
        $original_file_path = $original_file->pwd();
        $tempFile   = $_FILES['Filedata']['tmp_name'];

        move_uploaded_file($tempFile, $original_file_path);
 
        exec('/usr/bin/convert -geometry 400x350 ' . $original_file_path . ' ' . $this->Photo->getMediumFile($this->Photo->id, $secret)->pwd() .' > /dev/null 2>&1 &');

        exec('/usr/bin/convert -geometry 145x145 ' . $original_file_path . ' ' . $this->Photo->getSmallFile($this->Photo->id, $secret)->pwd() .' > /dev/null 2>&1 &');

        exec('/usr/bin/convert -thumbnail x150 -resize "150x<" -resize 50% -gravity center -crop 75x75+0+0 +repage ' . $original_file_path . ' ' . $this->Photo->getSquareFile($this->Photo->id, $secret)->pwd() .' > /dev/null 2>&1 &');
        exec('/usr/bin/convert -thumbnail x96 -resize "96x<" -resize 50% -gravity center -crop 48x48+0+0 +repage ' . $original_file_path . ' ' . $this->Photo->getBuddyFile($this->Photo->id, $secret)->pwd() .' > /dev/null 2>&1 &');

        exec('/usr/bin/convert -geometry 500x450 ' . $original_file_path . ' ' . $this->Photo->getLargeFile($this->Photo->id, $secret)->pwd() .' > /dev/null 2>&1 &');

      }

      echo 'OK';
      die();

      }
  }
  

and here is the Model photo.php 

<?php
class Photo extends AppModel {
  var $name = 'Photo';

    var $validate = array(
     'user_id' => array(
      'rule' => 'notEmpty'
     ),
     'name' => array(
      'rule' => 'notEmpty'
     ),
 );
 
  var $belongsTo = 'User';
  
  var $hasMany = array(
    'PhotoTag' => array('order' => array('tag' => 'ASC')),
    'PhotoNote' => array('order' => array('created' => 'ASC')),
  );



  function getOriginalFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'original' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
  
  function getLargeFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'large' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
  
  function getMediumFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'medium' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
  
  function getSmallFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'small' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
  
  function getThumbFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'thumb' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
  
  function getSquareFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'square' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
   
  function getBannerFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'banner' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
   
  function getBuddyFile($id, $secret, $create = null, $chmod = null)
  {
    return new File(WWW_ROOT . 'photos' . DS . 'buddy' . DS . $id . '-' . $secret . '.jpg', $create, $chmod);
  }
  

  function beforeDelete()
   {

     $this->loadModels('PhotoComment', 'PhotoTag', 'PhotoFavorite', 'PhotoLike', 'PhotoDislike', 'Notification');

     $photo = $this->findById($this->id());
     $this->secret = $photo['Photo']['secret'];
     
     foreach(array($this->getOriginalFile($this->id(), $this->secret), $this->getLargeFile($this->id(), $this->secret), $this->getMediumFile($this->id(), $this->secret), $this->getSmallFile($this->id(), $this->secret), $this->getThumbFile($this->id(), $this->secret), $this->getSquareFile($this->id(), $this->secret), $this->getBannerFile($this->id(), $this->secret), $this->getBuddyFile($this->id(), $this->secret)) as $file)
     {
       if($file->exists())
         $file->delete();
     }

   return true;  
   }


   function afterDelete()
   {
   
   }
    

}
?> 

I hope it helps,... enjoy it,... 

On Saturday, March 30, 2013 6:16:12 PM UTC-7, Robert Gravel wrote:
Hi All,
I am trying to use the cake_gallery plugin https://github.com/vitorpc/cake_gallery  for cake 1.3 but for some reason the thumbnail is not generated. Seems some issue with photo.php model??
In firebug i get some errors.
<b>Warning</b> (2)</a>: imagecreatetruecolor() [<a href='http://php.net/function.imagecreatetruecolor'>function.imagecreatetruecolor</a>]:
Invalid image dimensions [<b>APP\plugins\cake_gallery\models\photo
.php</b>, line <b>104</b>]
I have GD on my server. same errors on my server as my xampp server.

Anyone have any luck with this or can recommend a gallery plugin with upload and thumb creation
Thank you
Robert

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Cake Gallery

Hi All,
I am trying to use the cake_gallery plugin https://github.com/vitorpc/cake_gallery  for cake 1.3 but for some reason the thumbnail is not generated. Seems some issue with photo.php model??
In firebug i get some errors.
<b>Warning</b> (2)</a>: imagecreatetruecolor() [<a href='http://php.net/function.imagecreatetruecolor'>function.imagecreatetruecolor</a>]:
Invalid image dimensions [<b>APP\plugins\cake_gallery\models\photo
.php</b>, line <b>104</b>]
I have GD on my server. same errors on my server as my xampp server.

Anyone have any luck with this or can recommend a gallery plugin with upload and thumb creation
Thank you
Robert

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

retrieving data in a view cake 1.3

hi guys,... can anyone help please,... 
I have a data that I want to bring up to a view with foreach statement,... I can see notifications in debug mode, but I can't see real results... 

here is my function code: 

        $friends = $this->Friend->find('all', array('conditions' => array('Friend.user_id' => $user['User']['id'])));

            foreach($friends as $friend)
{

        $conditions = array('Notification.member_id' => $friend['User']['id']);
        $notifications = $this->Notification->find('all', array('conditions' => $conditions, 'order' => array('Notification.created' => 'DESC'), 'limit' => 12 ));
        $this->set('notes', $notifications);

       //  debug($notifications);


and here is the view: 

<?php foreach($notes as $note): ?>
   <strong><?php echo $html->link($application->cut($note['User']['firstname'] . ' ' . $note['User']['lastname'], 25), '/profile/' . $note['User']['username']) ?></strong>
...  ,...  ,...  ,... 
<?php endforeach ?> 


and Notification Model belongsTo association: 

var $belongsTo = array(
'User' => array('className' => 'User', 'foreignKey'    => 'member_id'),

thanks in advance 
chris

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Registration Question - Two Different Users (Not using User table)

Hey everyone. If this has been answered before, I didn't find it on the forums. Please link me if it was.

I'm a newbie with Cake. I've gone through and understand the MVC setup and how it works. However, before I spend another countless hours I was wondering if someone could point me into the right direction or provide examples.

I'm using the newest release of CakePHP (2.3).
I have a site with a registration page at domain.com/register.
Router::connect('/register', array('controller' => 'students', 'action' => 'index'));

 This page has a simple form with 

echo $this->Form->create('Student', array('action' => 'register'));
echo $this->Form->input('Full Name');
echo $this->Form->input('Email');
echo $this->Form->input('Password');
echo $this->Form->end('Register');
?>

I then have StudentsController :

function index() {
$this->set('title_for_layout', 'Register');
$this->layout = 'students';
$this->Student->recursive = 0;
$this->set('students', $this->paginate());
}
function register() {
if ($this->request->is('post')) {
$this->Student->create();
if ($this->Student->save($this->request->data)) {
 $this->Session->setFlash(__('The user has been saved'));
$this->redirect(array('action' => 'index'));
 } else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
}
}

and Student (model) :

App::uses('AuthComponent', 'Controller/Component');
class Student extends AppModel {
public $primaryKey = 'id';
    public $validate = array(
        
        'full_name' => array(
                'rule' => 'alphaNumeric',
                'message' => 'We need your name!',
                'required' => true
        ),
        'email' => array(
                'rule' => 'email',
                'message' => 'A valid email is required',
                'required' => true
        ),
        'password' => array(
        'password_one' => array(
                'rule' => array('minLength', '8'),
                'message' => 'Password is required (duh). Minimum of 8 characters.',
                'required' => true
                   )


); //END VALIDATE

}




 It's still messy too so ignore any errors (which don't affect what I'm trying to achieve) please. If I post the form, I get sent to /users/login. I'd like to be sent to /students/register since my router does it to /students/index. Then under register I want to handle all of the adding the user stuff (see "function register() {" in the code above).

What I'm trying to do is have the form register a user to the students table in my database. I will have to have another form on the site to register teachers and I want to keep them in separate databases. Problem is, all of the auth stuff is sent to UserController, which I don't want to use. I want to pass all Student login form stuff to the StudentController and all Teacher to the TeacherController.

In short, how do I achieve this? How do I force cakephp to use something other than the UserController to handle everything? If you need further clarification, please ask.

Thank you in advance!


 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

RE: Product / Category Tree Help

What I ended up doing is adding "path" field to the table and a pretty simple function to build the path for each category.

 

It needs to be cleaned up some for contain and cache but initial foundation appears to be in place. So this will build out the actual path no matter how deep the tree is.

buildPath() was just to build the initial paths for the new field in the db. When a category is created / modified the path will be automatically created on save.

 

Controller:

$this->Category->build_path();

 

Model:

public function build_path(){

                $categories = $this->find('all');

                               

                foreach ($categories as $k => $v){

                                $path = '';

                                $nest = $this->getPath($v['Category']['id']);

 

                                foreach($nest as $kk => $vv){

                                                $path .= $vv['Category']['slug'] . '/';

                                }

                $this->id = $v['Category']['id'];

                $this->saveField('path', $path);

                }

                               

}

 

And for the breadcrumbs:

<?php foreach ($path as $k['Category'] => $v):?>

               

<?php $this->Html->addCrumb($v['Category']['name'], array('controller' => 'categories', 'action' => 'view', $v['Category']['path']));?>

 

<?php endforeach; ?>

 

So in the end I get my respective paths such as:

'all/'

'all/men/'

'all/men/shoes/'

'all/men/sweaters/'

'all/men/watches/'

'all/men/jackets/'

'all/men/jeans/'

'all/men/accessories/'

'all/women/'

'all/women/shoes/'

'all/women/accessories/'

'all/women/jackets/'

'all/women/sweaters/'

'all/women/watches/'

'all/women/jeans/'

'all/men/shirts/'

'all/children/'

'all/children/shoes/'

'all/children/jackets/'

'all/children/jeans/'

'all/children/shirts/'

'all/women/shirts/'

'all/men/jackets/leather/'

'all/men/jackets/leather/black/'

'all/men/jackets/leather/brown/'

 

Still open to other ideas if there is something better or suggestions.

 

Thanks,

 

Dave

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Salines
Sent: Saturday, March 30, 2013 11:13 AM
To: cake-php@googlegroups.com
Subject: Re: Product / Category Tree Help

 

Create the following db tables:

 

table nodes, where you will have a minimum of the following fields: 

id, title, path, parent_id, lft, rght, type

 

In the field: path, save the full path on which you will find your posts.

Field: type, is reserved for storing content types, eg '1 '. categories, '2 '. products,..

 

 

table closures, view presentation

 

table posts, where you store the product description, etc

 

table atachments, where you store the product pictures..

 

 

Routing like this

 

Router::connect('/:path/*', array('admin'=>false,'controller' => 'nodes', 'action' => 'show'),array('pass'=>array('path','page'),'page' =>'[0-9]+'));

 

 

Node::show();

 

            public function show() {

                        $path = func_get_args();

                        //debug($path);

                        $last_arg = end(array_values($path));

 

                        if (is_numeric($last_arg)) {

                                    $page = $last_arg;

                                    //debug($page);

                                    array_pop($path);

                                    $path = implode("/", $path);

                                    $this -> request -> params['named']['page'] = $last_arg;

                        } else {

                                    $path = implode("/", $path);

                        }

....

}

Regards, Nikola

 

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

RE: Product / Category Tree Help

Thanks,

I will explore it and see how it turns out.

 

Dave

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Salines
Sent: Saturday, March 30, 2013 11:13 AM
To: cake-php@googlegroups.com
Subject: Re: Product / Category Tree Help

 

Create the following db tables:

 

table nodes, where you will have a minimum of the following fields: 

id, title, path, parent_id, lft, rght, type

 

In the field: path, save the full path on which you will find your posts.

Field: type, is reserved for storing content types, eg '1 '. categories, '2 '. products,..

 

 

table closures, view presentation

 

table posts, where you store the product description, etc

 

table atachments, where you store the product pictures..

 

 

Routing like this

 

Router::connect('/:path/*', array('admin'=>false,'controller' => 'nodes', 'action' => 'show'),array('pass'=>array('path','page'),'page' =>'[0-9]+'));

 

 

Node::show();

 

            public function show() {

                        $path = func_get_args();

                        //debug($path);

                        $last_arg = end(array_values($path));

 

                        if (is_numeric($last_arg)) {

                                    $page = $last_arg;

                                    //debug($page);

                                    array_pop($path);

                                    $path = implode("/", $path);

                                    $this -> request -> params['named']['page'] = $last_arg;

                        } else {

                                    $path = implode("/", $path);

                        }

....

}

Regards, Nikola

 

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Product / Category Tree Help

Create the following db tables:

table nodes, where you will have a minimum of the following fields: 
id, title, path, parent_id, lft, rght, type

In the field: path, save the full path on which you will find your posts.
Field: type, is reserved for storing content types, eg '1 '. categories, '2 '. products,..


table closures, view presentation

table posts, where you store the product description, etc

table atachments, where you store the product pictures..


Routing like this

Router::connect('/:path/*', array('admin'=>false,'controller' => 'nodes', 'action' => 'show'),array('pass'=>array('path','page'),'page' =>'[0-9]+'));


Node::show();

public function show() {
$path = func_get_args();
//debug($path);
$last_arg = end(array_values($path));

if (is_numeric($last_arg)) {
$page = $last_arg;
//debug($page);
array_pop($path);
$path = implode("/", $path);
$this -> request -> params['named']['page'] = $last_arg;
} else {
$path = implode("/", $path);
}
....
}
Regards, Nikola


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Product / Category Tree Help

Hi,

You need to build and implement closure table,

look at this excellent presentation http://www.slideshare.net/billkarwin/models-for-hierarchical-data (page 40),

I have recently implemented similar to www.farm.ba , where I now have the ability to create "unlimited" number of levels.

Save your full path in the db, and find posts by path exmp 

for all products path is products
for mens : products/mens
for mens shoes: products/mens/shoes
for model products/mens/shoes/some-model

Regards, Nikola

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Friday, March 29, 2013

Problem with nested AND / OR Condition

Hey Folks

maybe I'm just at a loss, but how do I create a SQL command like this with cakePHP?

SELECT *
FROM table
WHERE id = 1 OR (column1='test1' AND id=2) OR (column1='test2' AND id=3)


Please do not ask about the meaning, I have simplified a more complex command to make the problem clear.

The Condition would have to actually something like this:


$options = array(
'conditions' => array(
'OR' => array(
'id' => 1,
'AND' => array(
'column1' => 'test1',
'id' => 2
),
'AND' => array(
'column1' => 'test2',
'id' => 3
)
)
)
);

But the second 'AND' overrwrites the first one.

Can someone give me a hint? I would be grateful! ;-)

Greetings!
Carsten

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Product / Category Tree Help

I am building a shopping plugin and at the point where I am stuck with routing the correct/ custom path and breadcrumbs.

 

The Category model actsAs Tree so that houses all the categories / sub categories and the product belongs to the specific category so all that is fine.

 

The end goal is to be something like site/products/mens/shoes/{product_slug}
but how to properly build the route with unknown levels of the path since the end admin can make it to an unknown level deep like site/products/womens/jackets/leather/spring/{product_slug}

 

And same for the breadcrumb trail to easily navigate back any number of steps if needed.

What is the correct way to do this?

And is the best to paginate from which controller (products or categories?)

Pull products based on the category in ProductsController or get products based on the Category.id in CategoriesController $this->Category->Product->getProducts($category_id)?

 

Thanks for any insight / best approach.

 

Dave

Re: uppercase letter names in controller not working in shared hosting

Thanks Miles and Euromark. Thats really helpful :)

On Friday, March 29, 2013 2:15:24 AM UTC+5:30, Soumya Ranjan sahu wrote:
I have a cakephp site on bluehost. I have several contollers and some are named with 2  uppercase letters, i.e:- NotificationMessagesContoller.php while others are with 1 uppercase letters, i.e:- UsersController.php

The Users controller working fine but the NotificationMessage contoller shows problem like this "Missing controller: Error: NotificationmessageController not found ; createNotificationmessageController class in the .php file"

If I run the cakephp site on any localhost, all the links are working perfectly without any error.

Is there anybody who has faced this issue any time ?

Thanks for help


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Benchmark framework article

Interesting if your planning on building a large scale web infrastructure of your own, less so if you plan on using some of the ~80% commodity hosting out there with PHP already installed.

It's a bit like me driving a 1985 Mk II Golf because it's easy to find cheap parts and someone saying a Nissan Skyline is better (because it's faster) while disregarding price of car/shipping/parts/insurance/fuel/labour/etc.

Either way, I think they missed a few key things (not that it would suddenly make PHP compete some of the top languages):

- They used the "old stable" PHP 5.3 instead of the faster "current stable" PHP 5.4 - maybe only 13% faster overall, but it seems to be able to sort arrays 45% faster (quicker than Python btw)

- They didn't enable APC or any other op-code caching - this can give you 5x more requests per second (also, disable  `apc.stat` for another minor performance improvement)

- The raw PHP version uses a single database connection and a single prepared query in its loop, while the CakePHP benchmark doesn't even have persistent database connections enabled.

On Thursday, 28 March 2013 18:58:34 UTC, Miles J wrote:
Found this article. Pretty interesting that Cake is last place in every benchmark (given that it's multiple languages).

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Cakephp noobproblems..

.. and delete any files (not folders) from app/tmp/cache/*

On Thursday, 28 March 2013 09:04:12 UTC, Frederik De Roover wrote:
Hello,

I'm fairly new to Cake, but my former co-worker, made a localsite in cake, when we upload it to our webserver, everything works, we can connect to the database (for some points) but 1 page doesn't load, it gives us a whole lot off errors..
Can someone please point me in the right direction?


http://new.start2publish.be/Books

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?

The correct approach as outlined in the readme is to use the array syntax:

'field' => array('User.name', 'User.email', 'Profile.name',
'Profile.phone')


Now it works, I don't know why I didn't see that. Thank you.



--
View this message in context: http://cakephp.1045679.n5.nabble.com/CakeDC-Search-Plugin-How-to-search-2-fields-in-DB-using-only-1-form-field-tp5164502p5714325.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

How to render a CSS/JS files with a version parameter?

Hello guys,
I need help to solve the following problem:

using:
echo $ this-> Html-> css (array ('forms', 'tables', 'menu'));

is rendered:
<link rel="stylesheet" type="text/css" href="/css/forms.css" />
<link rel="stylesheet" type="text/css" href="/css/tables.css" />
<link rel="stylesheet" type="text/css" href="/css/menu.css" />

However, in cases, I will need to sequence the css and js files to make a versioning and avoid a possible cache in case of changes. I need outputs like:
<link rel="stylesheet" type="text/css" href="/css/forms.css?seq=1.2.3" />
<link rel="stylesheet" type="text/css" href="/css/tables.css?ver=20130329.1" />
<link rel="stylesheet" type="text/css" href="/css/menu.css?NoCacheAndNoPragmaNoCache=12345" />

How would I do this via html helper?

*I'm trainig my english

Many thks,
Fabrício

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: New to CakePHP

From the name of the controller file it appears that you're dealing with a 1.x install. Keep that in mind going forward, as there have been some changes to the API. If in doubt about any advice you receive, make a point of asking whether it's meant for a 1.x or 2.x version.

First thing to do is open app/config.routes.php and look for a path that matches what you're seeing in the browser. If you don't find it, then the URI itself probably contains everything you need to locate which controller/action you're dealing with. If the URI is "/contacts/email" then what you found is indeed the thing to focus on.

Next, open up app/config/bootstrap.php and look for lines like Configure::write('Site.contact_email', 'some address here'); If you don't find these lines add one for every ::read() you see.

You can use $this->log($someVar); anywhere in the controller. Pass it a string, array, object, whatever. Look in app/tmp/logs to see what you're getting. If there's supposed to be a user-provided msg from POST, that should be in $this->data:

if (!empty($this->data)) {
  $this->log($this->data);
  ...

You might want to consider emptying the logs first to make your job easier. (Keep a copy in case there's something in there that's important.) Make sure that the logs -- in fact everything in tmp -- is writable by the webserver process.

Can you post the relevant action (method)? It may be using Cake's built-in EmailComponent, or a plugin, or something else, so any more advice at this point would be guesswork. The mail might be using a local SMTP server, or it might be remote, etc. Check the $components array at the top of the class for anything that looks relevant to email. Ditto any imports.


On Wed, Mar 27, 2013 at 1:32 PM, Ellie Quick <ellie.quick78@googlemail.com> wrote:
Help,

Im a fairly experienced php coder however Ive been given access to a site (as the author is no longer contactable) written using CakePHP and Im totally and utterly lost as to how to make the fairly urgently required fixes.

Theres a contact form on one of the pages which doesnt work, no error messages to say whats wrong, Its meant to send an email to the site owner but nothing is ever received. Now this could be as simple as the wrong email address being used through to there simply being no back end code for sending the mail.

ive found a file called "contacts_controller.php" which contains an email function which is clearly designed to send the relevant emails however the bit thats losing me is:

$email_to = Configure::read('Site.contact_email');
$email_subject = Configure::read('Site.contact_email_subject');
$email_from = Configure::read('Site.contact_email_from');

I cant find anywhere, either in the site server files or the relevant database anything that appears to hold these variables.

Am I being dim?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: include file in cakephp

It's all just PHP, so include '...' will work. However, you'd likely be best off creating a helper. More that that I can't say as your question is pretty vague.


On Tue, Mar 26, 2013 at 7:14 AM, Oleksandr Torma <alexandertorma@gmail.com> wrote:
I want to include file from users - index.ctp to my plugin ... How can I do it?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Fatal error: Maximum execution time of 30 seconds exceeded


Hi,

  very interesting..! .. I got the same error, when i am new to the PHP..I find that solution....
It's nothing...Configure your php.ini file...change maximum execution time 30 seconds to 10000 seconds.....no need to worry..






On Wed, Mar 27, 2013 at 8:07 PM, Elias Munshya <munshyae@gmail.com> wrote:
i agree with

On Thursday, August 6, 2009 6:44:37 AM UTC+2, Arif wrote:
Thank you for your solution.
I have solved my problem according to ur suggestion(Given Function
name memory_limit).

On Aug 2, 4:28 am, joshua <josh...@gmail.com> wrote:
> In my opinion you can give a bigger number to memorry_limit in php.ini.
>
> On 8/2/09, arif hossen <arifhossen2...@gmail.com> wrote:
>
>
>
> > --
> > Dear All,
> > Please help me ,
> > How i can solve below this problem in cakephp ,I want to unlimited execution
> > time.
>
> > *Fatal error*: Maximum execution time of 30 seconds exceeded in *
> > D:\wamp\www\auctionsite\cake\libs\folder.php* on line *445*
>
> > Regards,
> > Mohammad Arif Hossen
> > Web Developer
> > United Group International(UGIBD)
> >www.ugibd.net
> > Mobile no:  +88 01714355911
> > Mobile no:  +88 01922110308
>
> --
> Thanks
> Joshua

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?

You need to pay more attention to the documentation

"AND `User.name, User.email, 
Profile.name, Profile.phone` LIKE"

is invalid SQL which you get when you do it wrong.

The correct approach as outlined in the readme is to use the array syntax:

     'field' => array('User.name', 'User.email', 'Profile.name', 'Profile.phone')

Note that you got 4 array elements here instead of one long one as in your case.





Am Donnerstag, 28. März 2013 20:33:20 UTC+1 schrieb Sergio Eustaquio Pereda Saviñón:
> > with my bugfixed and enhanced version you
can:https://github.com/dereuromark/search
>
> > but you should use an array structure then - like that:
>
> >   'field'=>array('Model1.entry1', 'Model1.entry2',
> > 'Model2.entry2', ...)
>

I'm using Cakephp V 2.3.1, and the plugin from Dereuromark branch fixed.

Im getting this error:
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.name,
User.email, Profile.name, Profile.phone' in 'where clause'

Database error:
SQL Query: SELECT `User`.`id`, `User`.`name`, `User`.`email`,
`User`.`password`, `User`.`login_id`, `User`.`profile_id`,
`User`.`activate`, `User`.`is_sadmin`, `User`.`ubuildinghive`,
`User`.`ustaff`,
...
`Profile`.`name`, `Profile`.`email2`, `Profile`.`app`, `Profile`.`apm`,
`Profile`.`phone`,
....
`Pbpermission`.`advertising`, `Pbpermission`.`techsupport`,
`Pbpermission`.`company`,
....
 FROM `buildhive`.`users` AS `User` LEFT JOIN `buildhive`.`profiles` AS
`Profile` ON (`User`.`profile_id` = `Profile`.`id`) LEFT JOIN
`buildhive`.`pbpermissions` AS `Pbpermission` ON (`User`.`pbpermission_id` =
`Pbpermission`.`id`) **WHERE `ubuildinghive` = 1 AND `User.name, User.email,
Profile.name, Profile.phone` LIKE '%adf%' LIMIT 20

User Model:
        public $actsAs = array('Search.Searchable', 'Containable');
        
        public $filterArgs = array(
                        'pbpermission_id' => array('type' => 'like'),
                        'search_email' => array('type' => 'like', 'field' => 'User.email'),
                        'pname' => array('type' => 'like', 'field' => 'Profile.name'),
                        'phone' => array('type' => 'like', 'field' => 'Profile.phone'),
                        'advanced' => array('type' => 'like', 'encode' => true, 'field' =>
array('User.name, User.email, Profile.name, Profile.phone') )
                );


User Controller:
CakePlugin::load( array('Search') );
public $components = array('Search.Prg');
public $presetVars = true;

public function index:
$this->Prg->commonProcess();
$this->paginate = array('User' => array('contain' => array('Profile',
'Pbpermission') ) );
                
$conditions = array('ubuildinghive' => 1 );
$options = array_merge($conditions,
$this->User->parseCriteria($this->passedArgs) );
$users = $this->paginate('User', $options );


Please help !!!!,



--
View this message in context: http://cakephp.1045679.n5.nabble.com/CakeDC-Search-Plugin-How-to-search-2-fields-in-DB-using-only-1-form-field-tp5164502p5714305.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: uppercase letter names in controller not working in shared hosting

Please follow conventions as documented.

If you got a controller in CamelCase (NotificationMessages), the access via url is always underscored: /notification_messages/action_name etc



Am Donnerstag, 28. März 2013 21:45:24 UTC+1 schrieb Soumya Ranjan sahu:
I have a cakephp site on bluehost. I have several contollers and some are named with 2  uppercase letters, i.e:- NotificationMessagesContoller.php while others are with 1 uppercase letters, i.e:- UsersController.php

The Users controller working fine but the NotificationMessage contoller shows problem like this "Missing controller: Error: NotificationmessageController not found ; createNotificationmessageController class in the .php file"

If I run the cakephp site on any localhost, all the links are working perfectly without any error.

Is there anybody who has faced this issue any time ?

Thanks for help


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.