Re: Plugin Facebook

2012-11-27 Thread Saran Pal
Hi Cyril,

Yes, I am using, please explain your problem, as your problem, you should
create an ctp which have only these two lines
 script type=text/javascript
window.close();
window.opener.location.reload(true);
/script
and render it while you fb things done.

Cheers..!

Saran Pal


On Mon, Nov 26, 2012 at 1:21 AM, Cyril CHARLIER cyril.charl...@gmail.comwrote:

 Hello,

 Is there somoene using this plugin on cake 2.x ?
 I have a little pb using it after the 2nd load of the page.

 thank.
 Cyril

  --
 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.




combine multiple foreach statements

2012-11-27 Thread Chris
hi guys,... can anyone help please,... 
I have 2 foreach statements in my view,... 

how can I combine two or more foreach statements to one,... ? 

  ?php $i = 0 ?
  ?php foreach($friends_photo_comments as $photo_comment): ?
[code]
   ?php $i++ ?
  ?php endforeach ?

   ?php $i = 0 ?
?php foreach($friends_blog_comments as $blog_comment): ?
[code]
?php $i++ ?
  ?php endforeach ?

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 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 to change order only for child elements in find('threaded').

2012-11-27 Thread Anna P
Thanks a lot!
Your suggestion solved my problem. Just like you said, I run select query 
with ascending order, then if the sorting is set to DESC, I run 
array_reverse on result set.
Cheers!:)

On Monday, November 26, 2012 8:10:50 PM UTC+1, cricket wrote:

 Model::_findThreaded() uses Set::nest() to create the threaded array. 
 So, perhaps the simplest approach would be to use 'ASC' by default, 
 then test for $sort _after_ you get the results back. To switch to 
 descending order for just the parent comments, run the result through 
 array_reverse(). 

 On Mon, Nov 26, 2012 at 5:10 AM, Anna P apa...@o2.pl javascript: 
 wrote: 
  Hello. 
  
  I got problem with setting up an order for child elements different than 
 for 
  parent elements. 
  I have a blog with comments. Users can switch between comments order - 
  comments can either be sorted descending or ascending. 
  The problem is, when the order is set to descending, also the child 
 elements 
  are sorted descending. That way, the child comments which are answers to 
  parent comments are also shown in a way that the newest one is on top. 
 And I 
  would like to order the child elements by ascending way, even when 
 parents 
  are sorted descending. 
  
  I tried to use IF statement in order clause like this: 
  
  if($sort=='desc') { 
$order='IF parent_id IS NULL THEN created desc ELSE created asc END'; 
  } else { 
$order='created asc'; 
  } 
  
 $comments=$this-Comment-find('threaded',array('conditions'=array('post_id'=$p['Post']['id']),
  

'fields'=array('Comment.id','parent_id','comment','created'), 
'order'=$order)); 
  
  but I get an error: 
  Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have 
 an 
  error in your SQL syntax; check the manual that corresponds to your 
 MySQL 
  server version for the right syntax to use near 'parent_id IS NULL THEN 
  created END desc, IF parent_id IS NOT NULL THEN id END as' at line 1 
  
  I've read somewhere that the DESC and ASC cannot be used inside IF or 
 CASE 
  statement. How else could the default ordering for whole table be 
 changes to 
  another only for child elements? 
  
  Regards  thank you in advance 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 post to this group, send email to cake...@googlegroups.comjavascript:. 

  To unsubscribe from this group, send email to 
  cake-php+u...@googlegroups.com javascript:. 
  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.




CakeSchema Problem

2012-11-27 Thread Sanjeev Divekar
Hello,

I am getting following warning for some tables (not all tables)

Invalid argument supplied for foreach() 
[CORE/Cake/Model/Datasource/DboSource.php, line 2840]

$table = $this-fullTableName($curTable);
foreach ($columns as $name = $col) {

while executing 

$CakeSchema-tables = array($table = $Model-_schema);
$File-write($DataSource-createSchema($CakeSchema, $table) . \n);

Thanks  Regards,
Sanjeev

-- 
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: CakePHP Media View Download of PDF Files Size Limit?

2012-11-27 Thread Blues Clues
Hi
Would you mind sharing the code snippet to download pdf files using 
mediaview in cakephp controller. I am able to download the file and but I 
try to open the pdf after the download is complete, I get invalid/corrupt 
file error from Adobe Reader.

Other file types work just fine. I wonder if the header needs to be setup 
in a certain way. 

I am using Cakephp 1.3

-BC



On Monday, March 28, 2011 8:40:14 PM UTC-4, Lawrence wrote:

 I've setup downloading of PDF files using the media view. It's working 
 great and I can basically force authentication prior to users 
 downloading the files. 

 The one problem I've run into is that once a PDF file goes over a 
 certain size, the file won't download. I'm given the prompt to 
 download the file, the option to specify where I'd like to save the 
 file, but after that the file download doesn't start. I've gone 
 through the logs (cake and apache) and cannot see anything obvious. 

 Again smaller PDF files are being downloaded properly. 

 Would love to hear if anyone else has run into this issue before or 
 whether anyone has any tips on where I can investigate further. 

 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.




Routes are confusing me

2012-11-27 Thread iFemke
I'm working on the routes of my CakePHP site. The 'easy' ones I have 
already set like:
Router::connect('/contact', array('controller' = 'contacts', 'action' = 
'index')); 
These are working.

But now I am confused as to how to continue with the more complex routing. 
For example, my url now is /findproducts/compare/1, where he goes to the 
controller findproducts and the action compare and 1 is the category_id. I 
have converted this with my routes to /vinden/vergelijk/1 (dutch 
translations). How do I get the 1 to swap with the category name? So that 
you don't get /vinden/vergelijken/1 but /vinden/vergelijken/food for 
example. Do I have to change all my html links for that? So that my 
controller doens't have  the action public function compare($id = null) 
but public function compare($categoryname = null)? I hope not, because 
that would be a lot of work..

Another question, in some controllers I work with $this-params, if I 
change my routing, will this effect my passed params? Because sometimes I 
need these params, but I rather not have my visitors see them. I don't know 
if that is possible.

I hope you understand what I want to do. I have read a lot about it (on the 
CakePHP website, this group, etc.) but I'm a little bit confused about how 
to do it. That's why I came 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: Routes are confusing me

2012-11-27 Thread lowpass
On Tue, Nov 27, 2012 at 10:16 AM, iFemke femkevgem...@gmail.com wrote:
 I'm working on the routes of my CakePHP site. The 'easy' ones I have already
 set like:
 Router::connect('/contact', array('controller' = 'contacts', 'action' =
 'index'));
 These are working.

 But now I am confused as to how to continue with the more complex routing.
 For example, my url now is /findproducts/compare/1, where he goes to the
 controller findproducts and the action compare and 1 is the category_id. I
 have converted this with my routes to /vinden/vergelijk/1 (dutch
 translations). How do I get the 1 to swap with the category name? So that
 you don't get /vinden/vergelijken/1 but /vinden/vergelijken/food for
 example. Do I have to change all my html links for that? So that my
 controller doens't have  the action public function compare($id = null)
 but public function compare($categoryname = null)? I hope not, because
 that would be a lot of work..


To use the Category name in the route you should take a look at
SluggableBehavior. What this does is create a new field based on the
name that is usable in a URL. eg. translates spaces to hyphens,
accented chars to ASCII, lowercase everything, etc. This occurs when
the record is saved. For existing records you can either create the
slugs yourself or edit each Category to re-save the record.

For a Category model I'm working on now, I'm using both Sluggable and Sortable:

public $actsAs = array(
'Sluggable' = array(
'translation' = 'utf-8',
'separator' = '-',
'label' = 'name',
'length' = 64,
'overwrite' = true
),
'Sortable' = array(
'orderField' = 'sort_order'
)
);

To use the slug in a route is fairly simple, but you need to keep in
mind what other potential routes may arise, so positioning in
routes.php can be important.

Router::connect(
'/findproducts/compare/:slug',
array(
'admin' = 1,
'controller' = 'findproducts',
'action' = 'compare'
),
array(
'slug' = '[-0-9a-z]+',
'pass' = array('slug')
)
);

Your method will then be:

public function compare($slug = null) {}

The you can pass the slug to your model methods and use a condition
$this-alias.slug = $slug

I prefer to use the id for admin methods, though:

Router::connect(
'/admin/categories/edit/:id',
array(
'admin' = 1,
'controller' = 'categories',
'action' = 'edit'
),
array(
'id' = '[0-9]+',
'pass' = array('id')
)
);


To create links is simple. Always fetch the slug when doing a find().
Then you can pass it to Html::link() like this:

foreach ($data as $d) {
echo $this-Html-link(
$d['Category']['name'],
array(
'controller' = 'findproducts',
'action' = 'compare',
'slug' = $d['Category']['slug']
),
array(
'title' = __('compare: ') . $d['Category']['name'],
'escape' = false
)
);
}

-- 
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: combine multiple foreach statements

2012-11-27 Thread lowpass
It's not clear what it is you want to do. Perhaps if you showed us the
code in between. Specifically, what is $i used for?

On Tue, Nov 27, 2012 at 5:15 AM, Chris chris...@yahoo.com wrote:
 hi guys,... can anyone help please,...
 I have 2 foreach statements in my view,...

 how can I combine two or more foreach statements to one,... ?

   ?php $i = 0 ?
   ?php foreach($friends_photo_comments as $photo_comment): ?
 [code]
?php $i++ ?
   ?php endforeach ?

?php $i = 0 ?
 ?php foreach($friends_blog_comments as $blog_comment): ?
 [code]
 ?php $i++ ?
   ?php endforeach ?

 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 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.




Redirect Loop

2012-11-27 Thread Andrew Johnston
Hello-

I'm having the weirdest Cake error with my code. When the code below calls 
the add() method (also reproduced here and from a different controller), 
the code redirects him back the edit() action (in essence, to the user it 
appears as if nothing happens). To further complicate matters, when I call 
the same URL when I'm not on that page (despite the pages not being reliant 
on each other), I get redirected to the base of my app, which results in a 
redirect loop. I tried calling other methods from this controller (with 
their proper arguments) to see if this was just a problem with the add() 
action, but I get the same redirect loop.

Here is the relevant code:
 function edit($id=null) {
 if(!$id) {
 $this-Session-setFlash('Invalid!');
$this-redirect(array(
'action' = 'index')
);

 }
 else {
 //Get the slides themselves
$slides = $this-Slide-find('all', array('conditions' = 
array('Slide.module_id' = $id)));
$this-set('slides', $slides);
//Get the data for the Module
$module = $this-Module-find('first',
array(
'conditions' = array (
'Module.id' = $id
),
'fields' = array(
'Module.module_name',
'Module.id')
)
);
 }
 }
And here is the add() code (again, from a different module):
function add($module = null) {
if ($this-request-is('get')) {
//Set some variables for the view (this code I know 
works as it has been used successfully elsewhere
} 
else { //User is POSTing
$this-Slide-create();
$this-Slide-save($this-data);
}
}

Thanks to everyone in advance; I couldn't do this without your support!

Andrew

-- 
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: rearrange multidimensional array in cakephp 2.2

2012-11-27 Thread lowpass
On Mon, Nov 26, 2012 at 6:59 PM, Marius neculamar...@gmail.com wrote:
 Hi all,
 I have this multidimensional assoc $modules array in cakephp 2.2.3:
 ...
 where it would be nice that 'category' would be sorted alphabetically within
 each parent 'type'

 I tried with

 $modules = Hash::combine($modules, '{n}', '{n}.{n}', '{s}.{s}.{n}.zone');

 but with no success. I guess I'm not using Hash::combine as I should...

Why not use Hash::sort()? I think you might have to run it through
each top-level array separately though.

Also, you could specify how to sort the associated records when Cake
fetches them.

-- 
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: combine multiple foreach statements

2012-11-27 Thread Chris
hi cricket,... 
the codes are simple, displaying photo comments and blog comments with 
limit to 12 from controller, and they works when each one is called 
separately in home page view ... I want to combine them in ONE array on 
first come first served bases (some user post on Blog,... and some user 
post on Photo),... 
$i is used for how many to display in a view,... e.g. $i++ up to 12, setup 
from controller,... 

this is for photo comments (in home page): 

  ?php $i = 0 ?

  ?php foreach($friends_photo_comments as $photo_comment): ?

div style=float: left; margin: 5px 0 15px 5px; width: 485px; 
 border-bottom: 1px dotted #aaa; display: block; overflow: hidden;

   div style=float: left; width: 480px; margin: 10px 0 5px 0;

   div style=float: left; width: 50px; margin: 0 0 5px 0; 
  ?php echo $html-link($profileShow-buddy($photo_comment, 
array('style' = 'border: 1px solid #2F2E2F;')), '/profile/' . 
$photo_comment['User']['username'], array('escape'=false, 'style' = 
'float: left;')) ?
/div


  div style=float: left; width: 425px; 

  div style=float: left; width: 400px; margin: 5px 0 5px 10px; 
font-size: 12px; display: block; overflow: hidden; 
  ?php echo ucfirst(__('by', true)) ?: 
  ?php echo 
$html-link($application-cut($photo_comment['User']['firstname'] . ' ' . 
$photo_comment['User']['lastname'], 25), '/profile/' . 
$photo_comment['User']['username'], array('style' = 'color: #000;')) ?
div class=clr/div
  ?php echo ucfirst(__('comment on', true)) ?: 
  ?php echo 
$html-link($application-cut($photo_comment['PhotoUser']['firstname'] . ' 
' . $photo_comment['PhotoUser']['lastname'], 25), '/profile/' . 
$photo_comment['PhotoUser']['username'], array('style' = 'color: #000;')) 
?
  ?php echo (__('photo', true)) ?
/div

div class=clr/div

div style=float: left; margin: 5px 0 0 10px; width: 400px; text-align: 
center;
  ?php echo $html-link($photoShow-medium($photo_comment, 
array('style' = 'border: 1px solid #2F2E2F;')), '/photos/show/' . 
$photo_comment['Photo']['id'], array('escape'=false)) ?
/div

div class=clr/div

div style=float: left; margin: 2px 0 0 10px; width: 400px; text-align: 
center; font-size: 11px;
  ?php echo $html-link(ucfirst(__('commnets', true)) . ' - ' . 
$photo_comment['Photo']['comments'], '/photos/show/' . 
$photo_comment['Photo']['id'], array('class' = 'comments16px')) ? 
  
?php echo $html-link(__('report/spam', true), '/report/photo/' . 
 $photo_comment['Photo']['id'], array('class' = 'report')) ?
  
  span class=comment/span span style=color: #aaa;?php echo 
$application-timeAgo($time, $photo_comment['PhotoComment']['created']) 
?/span
  /div

div class=clr/div

  div style=float: left; margin: 10px 0 10px 10px; width: 400px; 
font-size: 1.1em; font-weight: normal; display: block; overflow: hidden; 
?php echo 
$smile-replaceByIcon(nl2br($application-cut($photo_comment['PhotoComment']['content'],
 
125))) ?
/div

div class=clr/div

  /div
   /div
   /div

  div class=clr/div

  ?php $i++ ?
  ?php endforeach ?

  div class=clr/div

and this is for blog comments (in home page as well): 


  ?php $i = 0 ?

?php foreach($friends_blog_comments as $blog_comment): ?

div style=float: left; margin: 5px 0 15px 5px; width: 485px; 
 border-bottom: 1px dotted #aaa; display: block; overflow: hidden;

  div style=float: left; width: 480px; margin: 10px 0 5px 0;

  div style=float: left; width: 50px; margin: 0 0 5px 0; 
  ?php echo $html-link($profileShow-buddy($blog_comment, 
array('style' = 'border: 1px solid #2F2E2F;')), '/profile/' . 
$blog_comment['User']['username'], array('escape'=false, 'style' = 
'float: left;')) ?
/div


  div style=float: left; width: 425px; 

  div style=float: left; width: 400px; margin: 5px 0 5px 10px; 
font-size: 12px; display: block; overflow: hidden; 
  ?php echo ucfirst(__('by', true)) ?: 
  ?php echo 
$html-link($application-cut($blog_comment['User']['firstname'] . ' ' . 
$blog_comment['User']['lastname'], 25), '/profile/' . 
$blog_comment['User']['username'], array('style' = 'color: #000;')) ?
div class=clr/div

  ?php if(($blog_comment['User']['id']==$blog_comment['BlogUser']['id'])): 
? 
  ?php echo ucfirst(__('comment on own', true)) ? 
?php else: ?
  ?php echo ucfirst(__('comment on', true)) ?: 
  ?php echo 
$html-link($application-cut($blog_comment['BlogUser']['firstname'] . ' ' 
. $blog_comment['BlogUser']['lastname'], 25), '/profile/' . 
$blog_comment['BlogUser']['username'], array('style' = 'color: #000;')) ?
  ?php endif ?
  ?php echo (__('blog', true)) ?
/div

div class=clr/div

div style=float: left; margin: 5px 0 0 10px; width: 400px; text-align: 
left;

strong?php echo ucfirst(__('title', true)) ?:  /strong 
?php echo $html-link($application-cut($blog_comment['Blog']['name'], 
65), '/blogs/show/' . $blog_comment['Blog']['id']) ?

/div

div class=clr/div

  div style=float: left; margin: 5px 0 10px 10px; 

Re: combine multiple foreach statements

2012-11-27 Thread lowpass
On Tue, Nov 27, 2012 at 5:20 PM, Chris chris...@yahoo.com wrote:
 hi cricket,...
 the codes are simple, displaying photo comments and blog comments with limit
 to 12 from controller, and they works when each one is called separately in
 home page view ... I want to combine them in ONE array on first come first
 served bases (some user post on Blog,... and some user post on
 Photo),...
 $i is used for how many to display in a view,... e.g. $i++ up to 12, setup
 from controller,...

So you want to mix them together? Why not merge the two arrays and
sort by created then?

If they should be mixed, but have a maximum of 12 comments, what I
would do is create a Comment model that belongs to both Photo and Blog
(each of which hasMany Comment). In the comments table include columns
model and foreign_key.

BTW, you have a typo: __('commnets', true)

And if you're running 2.x you don't need to include the second parameter.

I still don't see where you're making use of $i in this code.

-- 
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: combine multiple foreach statements

2012-11-27 Thread Chris
I don't think it's possible to do that,... each Model has its own 
comments,... and there is not only Blogs and Photos, there are Groups, 
Videos, Dba, etc,... and I need to display them on Home page on first come 
first served bases,... it's kind of a Social Network site I'm rebuilding 
from 1.2 to 1.3,... thanks for typo notice,... lol 


On Tuesday, November 27, 2012 2:50:37 PM UTC-8, cricket wrote:

 On Tue, Nov 27, 2012 at 5:20 PM, Chris chri...@yahoo.com javascript: 
 wrote: 
  hi cricket,... 
  the codes are simple, displaying photo comments and blog comments with 
 limit 
  to 12 from controller, and they works when each one is called separately 
 in 
  home page view ... I want to combine them in ONE array on first come 
 first 
  served bases (some user post on Blog,... and some user post on 
  Photo),... 
  $i is used for how many to display in a view,... e.g. $i++ up to 12, 
 setup 
  from controller,... 

 So you want to mix them together? Why not merge the two arrays and 
 sort by created then? 

 If they should be mixed, but have a maximum of 12 comments, what I 
 would do is create a Comment model that belongs to both Photo and Blog 
 (each of which hasMany Comment). In the comments table include columns 
 model and foreign_key. 

 BTW, you have a typo: __('commnets', true) 

 And if you're running 2.x you don't need to include the second parameter. 

 I still don't see where you're making use of $i in this code. 


-- 
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.




XML doctype

2012-11-27 Thread technobulka
How to add doctype after *?xml version=1.0 encoding=UTF-8?*?

-- 
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: XML doctype

2012-11-27 Thread Chetan Patel
echo $this-Xml-header();

// generates: ?xml version=1.0 encoding=UTF-8 ?


You can pass in a different version number and encoding type as parameters
of the header method.

echo $this-Xml-header(array('version'='1.1'));
// generates: ?xml version=1.1 encoding=UTF-8 ?




-- 
Thanks  Regards

Chetan Patel

-- 
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.




Adding multple records through REST XML web services

2012-11-27 Thread Sam
Dear CakePHP experts,

I have an add() record function that is used as a REST web service via XML. 
The code is very simple. Something like below;

$this-Object-create();
$this-Object-save($this-request-data);

The limitation is that this function can only add one record at a time. 
What I want is to add multiple records at one time. The XML file can 
contain multiple records. So, I would like the function to be able to add 
multiple records via REST XML. May I know if CakePHP can be made to do this?

 I tried googling for a solution but could not find any. Can the experts 
here advise or provide some hints on how to start?

Thank you very much

-- 
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.