Re: ACL in helper
How does that help? Why wouldn't I reference the Acl component inside my current helper? For clarity... the helper parses a config file an build up an menu that contains one or many links - typically s into a . I want to be sure that the current user has permissions for 'this' action before adding the . Jeremy Burns Class Outfit http://www.classoutfit.com On 12 Jan 2013, at 03:19:45, Jamie wrote: > Do you mean that you want to use check the user's permissions inside your > plugin's helper? In that case, I would write another helper that you can use > to check all of the ACL permissions. > > On Thursday, January 10, 2013 9:21:54 PM UTC-8, Jeremy Burns wrote: > I have a Navigation plugin that contains a helper. It's used for creating > menus dynamically. I want to check a user's permissions via ACL before adding > a menu item. How can I user the ACL component inside the plugin? > > -- > 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Delete related data
Thanks for reply but still won't work. Question model: > > public $hasMany = array( > 'Option' => array( > ... > 'dependent' => true > ) > ); > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Deleting associated records
Hello Everyone, I need to delete associated records. I have tried but can't figure it out. Here is my situation, Database, questions {id(pk), question, answer} options {id(pk), question_id, option_value} Models, Question .. public $hasMany = array( 'Option' => array('dependant' => true)); .. Option .. public $belongsTo = array( 'Question' ); .. Controllers, QuestionController .. public function delete($id = null){ $this->Question->delete($id,true) } .. Still its not working with deletion. Otherwise everything works fine about association. Please Help Me. -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: ACL in helper
Do you mean that you want to use check the user's permissions inside your plugin's helper? In that case, I would write another helper that you can use to check all of the ACL permissions. On Thursday, January 10, 2013 9:21:54 PM UTC-8, Jeremy Burns wrote: > > I have a Navigation plugin that contains a helper. It's used for creating > menus dynamically. I want to check a user's permissions via ACL before > adding a menu item. How can I user the ACL component inside the plugin? -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Delete related data
Question model: public $hasMany = array( 'Option' => array( ... 'dependent' => true ) ); On Fri, Jan 11, 2013 at 4:03 AM, amitsukapure wrote: > Hi, > I have tried but still not working. > My situation, > Question hasMany Option > > Tables, > questions {id,question,answer} > options{id,option,question_id} > > In QuestionsController , in delete menthod, > $this->Question->delete($id,true); > > Everything works fine about association but not deletion. > Help me out. > Thanks > > > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Delete-related-data-tp1318091p5713148.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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Nested Html Helpers
On Fri, Jan 11, 2013 at 9:38 AM, wrote: > This is my first post so bare with me. > > How do you nest html helpers in cakePHP 2.x? You need to get your terminology straight first. A "helper" is class for creating or manipulating your view output. What you seem to be asking is how to get the HtmlHelper to create nested HTML tags. > I'd like to have a logo as a link and apply an inline style to it. echo $this->Html->link( $this->Html->img( 'path/to/the/image', array( 'width' => xxx, 'height' => yyy, 'alt' => 'blah blah blah', 'style' => 'for styling the img tag' ) ), array( // route or URL here ), array( 'style' => 'for styling the a tag', 'escape' => false // important when wrapping an img ) ); > I'd like to have a link and wrap it in a $this-Html-div() helper Keep in mind that you don't have to use the helpers for everything. You could just do: Html->link(...); ?> -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Conditional validation rule1 OR rule2
You'll need to create your own validation method. http://book.cakephp.org/2.0/en/models/data-validation.html#custom-validation-rules Personally, I'd create columns for both url and email in the table, then set up a custom rule to check that either one is there, and that whichever one is there is correct. Something like this: public $validate = array( 'email' => array( 'rule' => array('emailOrUrl', 'url'), 'message' => 'Please supply a valid URL or email address' ), 'url' => array( 'rule' => array('emailOrUrl', 'email'), 'message' => 'Please supply a valid URL or email address' ) ); function emailOrUrl($field = array(), $other_field = null) { $key = key($field); /* If this is empty, the other shouldn't be */ if (empty($field[$key]) && empty($this->data[$this-alias][$other_field])) { return false; } switch ($key) { case 'email': return $this->validator()->email($field[[$key]); case 'url': return $this->validator()->url($field[[$key]); default: return false; } } Check the API for other params you can pass to these two methods. http://api20.cakephp.org/class/validation On Fri, Jan 11, 2013 at 2:49 PM, gonzela2006 wrote: > Hello, > > I want to perform conditional validation between two rules > > public $validate = array( > 'variable' => array( > 'notEmpty' => array( > 'rule' => 'notEmpty' > ), > > 'url' => array( > 'rule' => array('url', true), > 'message' => 'Please supply a valid URL address.' > ) > > 'email' => array( >'rule'=> array('email', true), >'message' => 'Please supply a valid email address.' >) > > ) > ); > > I want to check if the "variable" is url or email > > Thanks, > gonzela2006 > > -- > 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Extending Plugin Question - location of new controllers/models/views
Yes, inside the Plugin directory. Where, as you see, it works. On Thu, Jan 10, 2013 at 5:09 PM, mk wrote: > Hi > > I’m using the cakedc users plugin in my app and have it working well. I’d > like to extend it now and I have read through the readme “How to extend the > plugin” https://github.com/CakeDC/users#how-to-extend-the-plugin, where they > give example controller called AppUsersController and model called AppUser. > > App::uses('UsersController', 'Users.Controller'); > > class AppUsersController extends UsersController { > > public function beforeFilter() { > > parent::beforeFilter(); > > $this->User = ClassRegistry::init('AppUser'); > > } > > } > > App::uses('User', 'Users.Model'); > class AppUser extends User { >public $useTable = 'users'; > } > > My question is where do you place this controller/model/view files? Do you > extend a plugin and place them the main app folders or the plugin folders? > > /myapp/Controller/AppUsersController.php > > Or > > /myapp/Plugin/users/Controller/AppUsersController.php > > I have tried both and it works in the /plugin/ folder but I just want to > make sure that is correct. > > Thanks 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Cake PHP doesn't work on Mac but on Windows
Check permissions of your files. it should be set to "Read and Write" On youtube, you could get some helpful videos on installing cake php on mac On Thursday, 10 January 2013 18:59:45 UTC+5:30, Theresia Z wrote: > > I have a big problem with Cakephp. We installed it and built an > application on windows, everything worked fine. Then I installed Cakephp on > two other windows-computers and copy-pasted the app-Data, it worked. Now I > tried the same thing on Mac and it wont work. > > The CakePHP installation works, the connection to the database is there > and on the cakephp-indexsite there are no errors. But as soon as I try to > open our application, I always get a 404-Error. The Code is exactly the > same like on my windows-pc and I don't understand why it wont work. > > On Windows, we are using XAMPP, on Mac, MAMPP. Might this be a problem? > > I hope you can help us with that. > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Delete related data
Hi, I have tried but still not working. My situation, Question hasMany Option Tables, questions {id,question,answer} options{id,option,question_id} In QuestionsController , in delete menthod, $this->Question->delete($id,true); Everything works fine about association but not deletion. Help me out. Thanks -- View this message in context: http://cakephp.1045679.n5.nabble.com/Delete-related-data-tp1318091p5713148.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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Nested Html Helpers
This is my first post so bare with me. How do you nest html helpers in cakePHP 2.x? Two examples: - I'd like to have a logo as a link and apply an inline style to it. - I'd like to have a link and wrap it in a $this-Html-div() helper Thanks. -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Find() returns different formatted array when using Postgresql vs Mysql ( any way to resolve this? )
I recognize this is an old thread, so I'm posting this answer here because I had the same issue today, and couldn't find a solution anywhere. I'll note I'm a relative novice to PHP. I ran into this issue converting a Cakephp 1.2 app from Mysql to Postgres. There are several instances of the "query" method, which returned zero-indexed arrays, like yours, instead of the table-name indices that the app was built to utilize. The cake 1.2 docs states that the array structuring of query results only works for Mysql, and may vary for different DB types. Bummer! I was afraid I'd have to modify hundreds of hard-coded queries to make my app work again. (I didn't build it, by the way - I was just tasked with converting it) Since I couldn't find a solution, I just dug around a little through Cake's dbo files, and added some lines that solved my problem: To 'appname/cake/libs/model/datasources/dbo/dbo_postgres.php' I modified the 'resultSet' method. I changed this: > while ($j < $num_fields) { > $columnName = pg_field_name($results, $j); > if (strpos($columnName, '__')) { > $parts = explode('__', $columnName); > $this->map[$index++] = array($parts[0], $parts[1]); > } else { > $this->map[$index++] = array(0, $columnName); > } > $j++; > } To include a new "else if" condition: while ($j < $num_fields) { > $columnName = pg_field_name($results, $j); > * $tableName = pg_field_table($results, $j); > * if (strpos($columnName, '__')) { > $parts = explode('__', $columnName); > $this->map[$index++] = array($parts[0], $parts[1]); > } *elseif ($tableName != 'columns' && $tableName != 'tables') { > $tableName = pg_field_table($results, $j); > $this->map[$index++] = array($tableName, $columnName);* > } else { > $this->map[$index++] = array(0, $columnName); > } > $j++; > } Basically, it was previously returning a zero-indexed array because it wasn't grabbing the table name. This new condition grabs the table name, and uses it as the array index, as is the default behaviour of the Mysql dbo. This worked for me, eliminating any need to change the previously working code. The bigger issue with the app I'm working on is that there shouldn't be so many hard-coded queries in there to begin with, but that's an issue for another, longer day. On Thursday, April 15, 2010 12:30:11 AM UTC-4, Adam wrote: > > When I do a find and get 1 row back in Postgres it has to be > referenced like $data[0][email] whereas in Mysql you can do > $data[Account][email]. > > I just migrated from Mysql to Postgres so I just have to go thru and > change all single result queries that formerly worked in Mysql as > $data[Account][email] to $data[0][email] in Postgres. > > Or is there something I'm doing wrong here? > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: rss helper elem method images cakephp 2.0
Not sure how the elem method works but here's how to add an image: set('channelData', array( 'title' => 'tet', 'link' => 'test', 'url' => 'test', 'description' => 'test', 'language' => 'en-us', 'managing-editor' => 'test', )); foreach($posts as $post) { // This is the part where we clean the body text for output as the description // of the rss item, this needs to have only text to make sure the feed validates $bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['excerpt']); $bodyText = $this->Text->stripLinks($bodyText); $bodyText = Sanitize::stripAll($bodyText); $bodyText = $this->Text->truncate($bodyText, 400, array( 'ending' => '...', 'exact' => true, 'html' => true, )); echo $this->Rss->item(array(), array( 'title' => $post['Post']['title'], 'link' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'guid' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'description' => $bodyText, 'pubDate' => $post['Post']['post_date'], 'enclosure' => array('url' => $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 'width' => '140', 'height' => '100') )); } ?> On Friday, January 11, 2013 1:49:29 PM UTC-5, TonyCharlotteCakePHP wrote: > > I'm trying to add images to my rss feed and I'm assuming that it can be > done using the elem method of the rss helper but I don't know how to use > elem method properly. If images are add a different way then please explain > as well. This is my rss.ctp view file: > > App::uses('Sanitize', 'Utility'); > > $this->set('channelData', array( > 'title' => 'test', > 'link' => 'test', > 'url' => 'test', > 'description' => 'test', > 'language' => 'en-us', > 'managing-editor' => 'test', > )); > > foreach($posts as $post) { > > // Clean the body text for output as the description of the rss > item, > // this needs to have only text to make sure the feed validates > $bodyText = preg_replace('=\(.*?\)=is', '', > $post['Post']['excerpt']); > $bodyText = $this->Text->stripLinks($bodyText); > $bodyText = Sanitize::stripAll($bodyText); > $bodyText = $this->Text->truncate($bodyText, 400, array( > 'ending' => '...', > 'exact' => true, > 'html' => true, > )); > > echo $this->Rss->item(array(), array( > 'title' => $post['Post']['title'], > 'link' => array( > 'controller' => 'streams', > 'action' => 'view', $post['Post']['id'] > ), > 'guid' => array( > 'controller' => 'streams', > 'action' => 'view', $post['Post']['id'] > ), > 'description' => $bodyText, > 'pubDate' => $post['Post']['post_date'], > //'elem' => array('media:thumbnail', array('url' => > $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), > 'width' => '75', 'height' => '75'), NULL, false) > 'enclosure' => 'test' > )); > } > ?> > > Here's the documentation: > http://book.cakephp.org/2.0/en/core-libraries/helpers/rss.html > http://api20.cakephp.org/class/rss-helper > http://api20.cakephp.org/file/Cake/View/Helper/RssHelper.php# > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Images in RSS Feed
I was taking a look at the RssHelper file and there is case for "enclosure" which is not documented but here's how it work: set('channelData', array( 'title' => 'test', 'link' => 'test', 'url' => 'tes', 'description' => 'test', 'language' => 'en-us', 'managing-editor' => 'test', )); foreach($posts as $post) { // This is the part where we clean the body text for output as the description // of the rss item, this needs to have only text to make sure the feed validates $bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['excerpt']); $bodyText = $this->Text->stripLinks($bodyText); $bodyText = Sanitize::stripAll($bodyText); $bodyText = $this->Text->truncate($bodyText, 400, array( 'ending' => '...', 'exact' => true, 'html' => true, )); echo $this->Rss->item(array(), array( 'title' => $post['Post']['title'], 'link' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'guid' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'description' => $bodyText, 'pubDate' => $post['Post']['post_date'], 'enclosure' => array('url' => $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 'width' => '140', 'height' => '100') )); } ?> I'm sure this can be done view the elem method but I'm not sure how to get that to work. On Friday, January 11, 2013 1:37:19 PM UTC-5, TonyCharlotteCakePHP wrote: > > I'm having the same issue. I'm assuming it can be done via elem method of > the Rss Helper class. > http://api20.cakephp.org/file/Cake/View/Helper/RssHelper.php# (scroll > down to the Rss helper class info). Here's what I have in my rss.ctp file > but I can't get the elem method to work properly: > > > App::uses('Sanitize', 'Utility'); > > $this->set('channelData', array( > 'title' => 'test', > 'link' => 'test', > 'url' => 'test', > 'description' => 'test', > 'language' => 'en-us', > 'managing-editor' => 'test', > )); > > foreach($posts as $post) { > > // Clean the body text for output as the description of the rss > item, > // this needs to have only text to make sure the feed validates > $bodyText = preg_replace('=\(.*?\)=is', '', > $post['Post']['excerpt']); > $bodyText = $this->Text->stripLinks($bodyText); > $bodyText = Sanitize::stripAll($bodyText); > $bodyText = $this->Text->truncate($bodyText, 400, array( > 'ending' => '...', > 'exact' => true, > 'html' => true, > )); > > echo $this->Rss->item(array(), array( > 'title' => $post['Post']['title'], > 'link' => array( > 'controller' => 'streams', > 'action' => 'view', $post['Post']['id'] > ), > 'guid' => array( > 'controller' => 'streams', > 'action' => 'view', $post['Post']['id'] > ), > 'description' => $bodyText, > 'pubDate' => $post['Post']['post_date'], > 'elem' => array('media:thumbnail', array('url' => > $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), > 'width' => '75', 'height' => '75'), NULL, false) > )); > } > ?> > > > > On Tuesday, April 17, 2012 4:21:48 AM UTC-4, Reza Talamkhani wrote: >> >> Hi, how can I insert images in my rss feed? I want one image to go >> with each post. >> >> index.ctp >> >> > $this->set('documentData', array( >> 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); >> >> $this->set('channelData', array( >> 'title' => __("پست های اخیر رضا تلم خانی"), >> 'link' => $this->Html->url('/', true), >> 'description' => __("وب سایت رسمی رضا تلم خانی"), >> 'language' => 'fa')); >> >> App::uses('Sanitize', 'Utility'); >> foreach ($posts as $post) { >> //$postTime = strtotime($post['Post']['created']); >> >> $postLink = array( >> 'controller' => 'posts', >> 'action' => 'view', >> $post['Post']['id'], >> //'year' => date('Y', $postTime), >> //'month' => date('m', $postTime), >> //'day' => date('d', $postTime), >> //$post['Post']['slug'] >> ); >> >> // This is the part where we clean the body text for output as the >> description >> // of the rss item, this needs to have only text to make sure the >> feed validates >> $bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['body']); >> $bodyText = strip_tags($bodyText); >> $bodyText = $this->Text->stripLinks($bodyText); >> $bodyText = Sanitize::stripAll($bodyText)
Re: CakePHP site is down
Aaaand it's up again :) On Friday, January 11, 2013 10:39:46 PM UTC+1, sdc53 wrote: > > Just thought I'd let someone know, in case you didn't already. > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
CakePHP site is down
Just thought I'd let someone know, in case you didn't already. -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Conditional validation rule1 OR rule2
Hello, I want to perform conditional validation between two rules public $validate = array( 'variable' => array( 'notEmpty' => array( 'rule' => 'notEmpty' ), 'url' => array( 'rule' => array('url', true), 'message' => 'Please supply a valid URL address.' ) 'email' => array( 'rule'=> array('email', true), 'message' => 'Please supply a valid email address.' ) ) ); I want to check if the "variable" is url *or* email Thanks, gonzela2006 -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
rss helper elem method images cakephp 2.0
I'm trying to add images to my rss feed and I'm assuming that it can be done using the elem method of the rss helper but I don't know how to use elem method properly. If images are add a different way then please explain as well. This is my rss.ctp view file: set('channelData', array( 'title' => 'test', 'link' => 'test', 'url' => 'test', 'description' => 'test', 'language' => 'en-us', 'managing-editor' => 'test', )); foreach($posts as $post) { // Clean the body text for output as the description of the rss item, // this needs to have only text to make sure the feed validates $bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['excerpt']); $bodyText = $this->Text->stripLinks($bodyText); $bodyText = Sanitize::stripAll($bodyText); $bodyText = $this->Text->truncate($bodyText, 400, array( 'ending' => '...', 'exact' => true, 'html' => true, )); echo $this->Rss->item(array(), array( 'title' => $post['Post']['title'], 'link' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'guid' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'description' => $bodyText, 'pubDate' => $post['Post']['post_date'], //'elem' => array('media:thumbnail', array('url' => $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 'width' => '75', 'height' => '75'), NULL, false) 'enclosure' => 'test' )); } ?> Here's the documentation: http://book.cakephp.org/2.0/en/core-libraries/helpers/rss.html http://api20.cakephp.org/class/rss-helper http://api20.cakephp.org/file/Cake/View/Helper/RssHelper.php# -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Images in RSS Feed
I'm having the same issue. I'm assuming it can be done via elem method of the Rss Helper class. http://api20.cakephp.org/file/Cake/View/Helper/RssHelper.php# (scroll down to the Rss helper class info). Here's what I have in my rss.ctp file but I can't get the elem method to work properly: set('channelData', array( 'title' => 'test', 'link' => 'test', 'url' => 'test', 'description' => 'test', 'language' => 'en-us', 'managing-editor' => 'test', )); foreach($posts as $post) { // Clean the body text for output as the description of the rss item, // this needs to have only text to make sure the feed validates $bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['excerpt']); $bodyText = $this->Text->stripLinks($bodyText); $bodyText = Sanitize::stripAll($bodyText); $bodyText = $this->Text->truncate($bodyText, 400, array( 'ending' => '...', 'exact' => true, 'html' => true, )); echo $this->Rss->item(array(), array( 'title' => $post['Post']['title'], 'link' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'guid' => array( 'controller' => 'streams', 'action' => 'view', $post['Post']['id'] ), 'description' => $bodyText, 'pubDate' => $post['Post']['post_date'], 'elem' => array('media:thumbnail', array('url' => $this->Html->url('/app/webroot/'.$post['Post']['image_site_thumb'], true), 'width' => '75', 'height' => '75'), NULL, false) )); } ?> On Tuesday, April 17, 2012 4:21:48 AM UTC-4, Reza Talamkhani wrote: > > Hi, how can I insert images in my rss feed? I want one image to go > with each post. > > index.ctp > > $this->set('documentData', array( > 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); > > $this->set('channelData', array( > 'title' => __("پست های اخیر رضا تلم خانی"), > 'link' => $this->Html->url('/', true), > 'description' => __("وب سایت رسمی رضا تلم خانی"), > 'language' => 'fa')); > > App::uses('Sanitize', 'Utility'); > foreach ($posts as $post) { > //$postTime = strtotime($post['Post']['created']); > > $postLink = array( > 'controller' => 'posts', > 'action' => 'view', > $post['Post']['id'], > //'year' => date('Y', $postTime), > //'month' => date('m', $postTime), > //'day' => date('d', $postTime), > //$post['Post']['slug'] > ); > > // This is the part where we clean the body text for output as the > description > // of the rss item, this needs to have only text to make sure the feed > validates > $bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['body']); > $bodyText = strip_tags($bodyText); > $bodyText = $this->Text->stripLinks($bodyText); > $bodyText = Sanitize::stripAll($bodyText); > $bodyText = $this->Text->truncate($bodyText, 400, array( > 'ending' => '...', > 'exact' => true, > 'html' => true, > )); > > echo $this->Rss->item(array(), array( > 'title' => $post['Post']['title'], > 'link' => $postLink, > 'guid' => array('url' => $postLink, 'isPermaLink' => 'true'), > 'description' => $bodyText, > 'creator' => $post['User']['full_name'], > 'pubDate' => $post['Post']['created'], > )); > } > > ?> > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: viewing PDF
No, I've done that Op donderdag 10 januari 2013 schreef euromark (dereurom...@gmail.com) het volgende: > You forgot the RequestHandler component, didnt you? > > > Am Donnerstag, 10. Januar 2013 17:19:15 UTC+1 schrieb Dr. Drijk: >> >> I'm using the CakePdf-plugin to parse a view as pdf. >> >> I added to \app\config\bootstrap.php : >> CakePlugin::load('CakePdf', array('bootstrap' => true, 'routes' => >> true)); >> >> Configure::write('CakePdf', array( >> 'engine' => 'CakePdf.WkHtmlToPdf', >> 'margin' => array( >> 'bottom' => 15, >> 'left' => 50, >> 'right' => 30, >> 'top' => 45 >> ), >> 'orientation' => 'landscape', >> 'download' => true >> )); >> >> and to app\config\routes.php: >> Router::parseExtensions('rss', 'json', 'xml', 'pdf'); >> >> I added the pdf-folders, and created view.ctp, and default.cpt >> >> When I try the view action : /view/1 I get the corresponding view, >> either when i try /view/1.pdf, I don't get a pdf-page but the same html >> >> Where did it go wrong??. >> >> >> >> >> >> >> -- > 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 post to this group, send email to > cake-php@googlegroups.com 'cake-php@googlegroups.com');> > . > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com 'cake-php%2bunsubscr...@googlegroups.com');>. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Baking cake 2.4
make sure you are in the 'app' directory then run cake bake...it happens sometimes... On Sunday, January 6, 2013 8:08:07 AM UTC-5, Olufemi Oluoje wrote: > > Pls can anyone send me the link of how to bake cake 2.4. Because I have > been having issues, due to change in the folder structure from 1.3 to 2.x. > Pls, anyone link to a tutorial? Or pasting it here. > Am baking my cakephp on windows 7 > > Thanks all. > Sent from my BlackBerry® smartphone provided by Airtel Nigeria. -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Related data when using pages controller
Just an fyi for anyone who may have an issue in 2.x when viewing a pr($this->Model->find('all'); from the pages controller, make sure that first letter is capitalized (which is what you should be doing anyway). lol I spent a few minutes trying to find out why the heck none of the relations were coming through, when the issue was that in the $uses array, I had specified the model with a lowercase instead of an uppercase, which as soon as I corrected that and updated the corresponding calls all was back to normal. Just wanna save someone some time if searching on 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Cake PHP doesn't work on Mac but on Windows
Make sure your .htaccess files all copied over correctly. This happens alot on macs if you dont have it set up for hidden files On Thursday, January 10, 2013 8:29:45 AM UTC-5, Theresia Z wrote: > > I have a big problem with Cakephp. We installed it and built an > application on windows, everything worked fine. Then I installed Cakephp on > two other windows-computers and copy-pasted the app-Data, it worked. Now I > tried the same thing on Mac and it wont work. > > The CakePHP installation works, the connection to the database is there > and on the cakephp-indexsite there are no errors. But as soon as I try to > open our application, I always get a 404-Error. The Code is exactly the > same like on my windows-pc and I don't understand why it wont work. > > On Windows, we are using XAMPP, on Mac, MAMPP. Might this be a problem? > > I hope you can help us with that. > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Cake 2.0 - How to Specify a Primary Key
kudos On Tuesday, January 8, 2013 9:42:28 PM UTC-5, Andras Kende wrote: > > > http://book.cakephp.org/2.0/en/models/model-attributes.html#primarykey > > app/Models/User.php : > > class User extends AppModel { > public $primaryKey = 'users_id'; > } > > > Andras Kende > http://www.kende.com > > On Jan 8, 2013, at 1:52 PM, Brian QIS > > wrote: > > > Hello, > > > > We're coming from a custom CMS, and our MySQL database naming convention > is a bit different. So, if I have a table called "users" with a primary key > of "users_id", how do I set my model to look for "users.users_id" as the > record ID rather than "users.id?" > > > > Thanks! > > > > -- > > 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 post to this group, send email to cake...@googlegroups.com. > > > To unsubscribe from this group, send email to > cake-php+u...@googlegroups.com . > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > > > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Baking cake 2.4
On Sunday, 6 January 2013 14:08:07 UTC+1, Olufemi Oluoje wrote: > > Pls can anyone send me the link of how to bake cake 2.4. Because I have > been having issues, due to change in the folder structure from 1.3 to 2.x. > Pls, anyone link to a tutorial? Or pasting it here. > Am baking my cakephp on windows 7 > > Thanks all. > Sent from my BlackBerry® smartphone provided by Airtel Nigeria. > Console/cake bake should be all you need to know - if you're not doing that - what are you doing? AD -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: How Can I use different AppController with specific route prefix!?
On Thursday, 10 January 2013 19:55:49 UTC+1, Khaled Attia wrote: > > Hello, > > I'm going to create API provider for my application, and I don't want to > split the API from the main app because there is a lot of tables relations > in models and components and other stuff that I want to use with the API, > In same time I don't want to use the main AppController because there is a > lot of things that happen with each controller (DB queries, load helpers, > components, redirects, ...etc) that I don't want to use in API. > > I tried to create a new directory and at it to App::Build > Don't do that - in short is won't work. If you don't want your ApiAppController to extend AppController - then (surprise) extend Controller and mission accomplished. If your Api code is not already in a plugin - that's of course something you should change first, so that your api code is encapsulated in a tidy folder. AD -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Cake PHP doesn't work on Mac but on Windows
On Thursday, 10 January 2013 14:29:45 UTC+1, Theresia Z wrote: > > I have a big problem with Cakephp. We installed it and built an > application on windows, everything worked fine. Then I installed Cakephp on > two other windows-computers and copy-pasted the app-Data, it worked. Now I > tried the same thing on Mac and it wont work. > > The CakePHP installation works, the connection to the database is there > and on the cakephp-indexsite there are no errors. But as soon as I try to > open our application, I always get a 404-Error. The Code is exactly the > same like on my windows-pc and I don't understand why it wont work. > > On Windows, we are using XAMPP, on Mac, MAMPP. Might this be a problem? > > I hope you can help us with that. > Sounds like you haven't setup mod rewrite on your Mac install. Some specific info (like exactly what url you're requesting - exactly what you receive - exactly what your apache error log says) will help others help you if that's not the case . AD -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Mongo php process slowness
On Thursday, 10 January 2013 09:16:13 UTC+1, Raju Bishnoi wrote: > > Hi, > > I run the below php code with Mongo & MongoClient to insert 100k records. > Mongo took 70-75 second to complete and MongoClient took 440-450 second. > > $start = microtime(true); > > $objBaseMongoRecord = new BaseMongoRecord(); > > $objBaseMongoRecord-> > setCollectionName("mongotest"); > > $i = 0; > while ($i < 100) { > > $data = array( > "name" => array( > "firstname" => "raju" . $i, > "lastname" => "bishnoi" . $i), > "address" => array( > "street" => "raju" . $i, > "city" => "city" . $i, > "state" => "state" . $i, > "country" => "country" . $i, > "zipcode" => "1" . $i), > "officephone" => "25412541", > "homephone" => "625412541", > "status" => "A", > "date" => date('Y-m-d:H-i-s'), > "time" => time()); > > $objBaseMongoRecord->ensureIndex(array("time" => 1)); > $objBaseMongoRecord->insert($data); > $i++; > } > > $duration = microtime(true) - $start; > // print in the format 1.2345 for better reading > printf("took %0.4d seconds", $duration); > > Can anyone tell me why MongoClient tooks more time and how to make it fast. > Don't do via php, what you can do directly on the database. if you run code like this directly on the server there is 0 network traffic. if you do it with any other client, you have constant traffic as your php code sends each bit of data to the database. First optimize your code - you're dong a bulk insert - so do exactly that, one insert call. In this example send MongoCode to the db, it'll execute in the shortest execution time and come back. AD http://php.net/manual/en/class.mongocode.php http://php.net/manual/en/mongocollection.batchinsert.php -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Extend Paginator maxlimit to more than 100
I think is paginate name for property, not paginator Dne 11. jan. 2013 11:15 je "Sam" napisal/-a: > Dear CakePHP experts, > > The default maxLimit for Paginator component is 100. For some reason, I > would like to extend it to 1000 to all my controllers. What I did was to > add the following code inside class AppController. Is it correct? > > Inside class AppController extends Controller, > > *public $paginator = array (* > * 'maxLimit' =>1000,* > * 'limit' =>1000 * > * );* > > Thank you for your 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 post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > -- 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Extend Paginator maxlimit to more than 100
Dear CakePHP experts, The default maxLimit for Paginator component is 100. For some reason, I would like to extend it to 1000 to all my controllers. What I did was to add the following code inside class AppController. Is it correct? Inside class AppController extends Controller, *public $paginator = array (* * 'maxLimit' =>1000,* * 'limit' =>1000 * * );* Thank you for your 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 post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.