cakephp-1.3

cakephp find('list') for select box

北城余情 提交于 2020-01-06 20:23:46
问题 I am trying to implement selectbox in my site.Option for that selectbox is set in my controller like below $tmp_user = $this->User->find('first',array('id'=>$this->Auth->user('id'))); $zip_info = $this->Zipcode->find('first',array('id'=>@$tmp_user['User']['zip_id'])); $region_admins = $this->AdminRegion->find('all',array('conditions'=>array('AdminRegion.region_id'=>@$zip_info['Zipcode']['region_id']))); if(!empty($region_admins)){ foreach($region_admins as $radmn): //pr($radmn); $admin_user =

Cakephp sending UTF-8 Emails and lineLength

梦想的初衷 提交于 2020-01-06 07:26:14
问题 I'm trying to send an emails with UTF8 characters. Mostly the Email looks how I suspect, but randomly there will be garbage characters. I believe the garbage characters happen when a new line is inserted in the middle of one of the characters. I suspect CakePHP's email component is the culprit since I was reading that it has a feature to insert new lines according to its lineLength property. Is there any way to fix this? I'm using CakePHP 1.3. $this->Email->to = $sendEmail; $this->Email->from

CakePHP - file structure confusion - different controllers, or all in same?

末鹿安然 提交于 2020-01-06 07:13:07
问题 To understand my confusion/question, let me first give a quick overview of the site I'm building: The site has a homepage, and 7 category pages, each with the same/similar layout. On most category homepages (eg "Dining"), you can do a search (ie a search for restaurants), which will take you to a results page. This will have the same/similar layout as the... "Theaters" search result page...etc etc. So - although there are a lot of sections, there are not a lot of page layouts. Question: I'm

CakePHP - file structure confusion - different controllers, or all in same?

[亡魂溺海] 提交于 2020-01-06 07:11:39
问题 To understand my confusion/question, let me first give a quick overview of the site I'm building: The site has a homepage, and 7 category pages, each with the same/similar layout. On most category homepages (eg "Dining"), you can do a search (ie a search for restaurants), which will take you to a results page. This will have the same/similar layout as the... "Theaters" search result page...etc etc. So - although there are a lot of sections, there are not a lot of page layouts. Question: I'm

CakePHP error Allowed memory size exhausted

Deadly 提交于 2020-01-06 05:36:06
问题 On one of my PHP applications I get Allowed memory size exhausted error. What did i done wrong to get that error? It's showing on pages where i use more-less usual cakephp methods like 'find', to select record from database table, on index (list) pages. How can i fix that? problem is that i can not set memory size on commercial servers.... Thank you in advance! 回答1: Research the 'Containable' behavior for your models. It's a core behavior, and it sounds like you need to add it to your finds,

Bindmodel to binded model? Cakephp

删除回忆录丶 提交于 2020-01-06 04:54:06
问题 I bind ProductsPhoto to children using bindModel method: $this->Category->bindModel(array ('hasMany' => array( 'ProductsPhoto' => array... How can I bind ProductsPhoto to every product item? Or maybe any other solution suggestion? 回答1: in your controller ,write below code $this->ProductsPhoto->bindModel('hasMany' => array('Product.productphoto_id' => 'ProductPhoto.id'); in your ProductPhoto model, var $hasMany = array( 'Product' => array( 'className' => 'ProductPhoto', 'foreignKey' =>

facebook open graph meta property og:type of 'website'. The property 'object-name' requires an object of og:type 'object-name'

心已入冬 提交于 2020-01-05 12:08:08
问题 in cake php 1.3 in view ctp i have follow code: $url = 'http://example.com/exmp/explus/books/view/'.$book['Book']['id']; echo $this->Html->meta(array('property' => 'fb:app_id', 'content' => '*******'),'',array('inline'=>false)); echo $this->Html->meta(array('property' => 'og:type', 'content' => 'book'),'',array('inline'=>false)); echo $this->Html->meta(array('property' => 'og:url', 'content' => $url ),'',array('inline'=>false)); echo $this->Html->meta(array('property' => 'og:title', 'content'

Email template not using themed version

瘦欲@ 提交于 2020-01-05 10:13:15
问题 I am using CakePHP 1.3 and the built in email features as described in the documentation. I have the html version of the template located in app/views/elements/email/html/reservation.ctp and its working as expected. $this->Email->template = 'reservation'; // no '.ctp' I also have a theme setup and most of the themed files are correctly overriding the default files. My problem is the themed email template is not being used when called from the themed site, its still using the email template

CakePHP + Facebook Graph API

試著忘記壹切 提交于 2020-01-05 05:01:55
问题 I wanna integrate Facebook's new Graphs API with my CakePHP application. Can some one help me if there is some kind of a plugin. Mainly looking at the following functionality Facebook Login Publishing on the Users Wall Inviting Users Friends. Give access to the persons Facebook page and post and retrieve content of the page. Post content to the facebook page's wall of the application 回答1: I can recommend Nick Baker's CakePHP Facebook plugin. It's easy enough to set up. 来源: https:/

How do I validate URL, but ignore if http:// or blank?

China☆狼群 提交于 2020-01-04 05:45:12
问题 I want to validate a form field for URL. I have set the default for the field to http://. When the user doesn't enter a URL, and leaves the http://, it says invalid URL. URL is not required, so if it's only http://, it should not show error message. How can I make it ignore if the person submits http:// as the URL? Thanks 回答1: http:// is not a valid url, so if you want to allow it anyway there are 2 options create a custom validation rule, that returns true for a real url + http:// use the