Re: No cases in url parameters ?

2012-07-08 Thread JonStark
Oh thanks never knew about this ! Do you know how to edit a table field with phpMYAdmin to allow case sensitivity ? Thanks ! Le dimanche 8 juillet 2012 02:16:09 UTC+2, JonStark a écrit : > > Hi ! > > I have an app where user profiles can be found thanks to their username or > ha

No cases in url parameters ?

2012-07-07 Thread JonStark
Hi ! I have an app where user profiles can be found thanks to their username or hash as parameter : public function view($username) { > $user = $this->User->find('first', array( > 'conditions' => array( > "or" => array( > 'User.hash' => $username, > '

Regroup actions from different controllers (API related) ?

2012-07-06 Thread JonStark
Hi everyone ! I'm asking here because you guys are reactive and know your business :D I have a simple question. I have an app, and I'm making a public API (xml and json) thanks to request handling. But I have a question. I have actions from different controllers (Users/view/xml/action.ctp, Pos

Re: Finding an user with a field from associated data ?

2012-07-05 Thread JonStark
} But then in the model, the code below returns find function on a non object... what am I doing wrong? : public function countFollowing($id) { > $following = $this->UsersUser->find('count', array( > 'conditions' => array( > 'follower_id' =>

Re: Finding an user with a field from associated data ?

2012-07-04 Thread JonStark
#x27;foreignKey' => 'following_id', > 'associationForeignKey' => 'follower_id', > 'unique' => true, > 'conditions' => '', > 'fields' => '', >

Re: Finding an user with a field from associated data ?

2012-07-04 Thread JonStark
Thanks for the advice, but when I tried this, it returned : Call to a member function find() on a non-object for this code : public function countFollowing($id) { > $user = $this->User->UserUsers->find('all', array( > 'conditions' => array( > 'follower_id' => $id > ), > )); > debug($user); >

Finding an user with a field from associated data ?

2012-07-04 Thread JonStark
Hi everyone ! I have a question that shouldn't be that hard but I really can't manage it : In my app, User HABTM User users_users table is : id, following_id, follower_id I want to count every user where follower id is $id. This is my function : public function countFollowing($id) { > $user =

Re: Get full path with file input ? (IMGUR related)

2012-07-03 Thread JonStark
It did the trick ! Thans a lot :) Le lundi 2 juillet 2012 12:47:06 UTC+2, JonStark a écrit : > > I'm trying to add a file upload to a form in cake 2.x : > > Controller : > > public function add() { >> >> if ($this->request->is('post'))

Re: Get full path with file input ? (IMGUR related)

2012-07-03 Thread JonStark
Does someone has any clue ? Still stuck with this... thanks a lot. Le lundi 2 juillet 2012 12:47:06 UTC+2, JonStark a écrit : > > I'm trying to add a file upload to a form in cake 2.x : > > Controller : > > public function add() { >> >> if ($this->r

Get full path with file input ? (IMGUR related)

2012-07-02 Thread JonStark
I'm trying to add a file upload to a form in cake 2.x : Controller : public function add() { > > if ($this->request->is('post')) { > $this->request->data['Post']['user_id'] = > $this->Auth->user('id'); //stores user id > $filename = $this->request->data['Post']['imgur'];

Re: Ajax pagination returns the whole page instead of the requested div

2012-07-01 Thread JonStark
t; > you don't need to include RequestHandler component. > OFC, you have to be on 2.x cake that will work this :) > > element('posts'); ?> > > why si "" there ? > > -- > Lep pozdrav, Tilen Majerle > http://majerle.eu > > > > 2012/7/1

Ajax pagination returns the whole page instead of the requested div

2012-07-01 Thread JonStark
Hello everyone. I'm trying to do a Twitter style auto- load more when scrolling : > > > > >element('posts'); ?> > > > > > > > echo $this->Html->script('jquery', false); > $maxPage = $this->Paginator->counter('%pages

Re: Simply refresh page with Js helper.

2012-06-26 Thread JonStark
Is there a way to simply make a refresh button with Js helper so it does not refresh the page, but only reload the content of the page/div ? Sorry I mis-explained. Le mardi 26 juin 2012 13:50:04 UTC+2, JonStark a écrit : > > Is there a way to simply make a refresh button with Js helper

Simply refresh page with Js helper.

2012-06-26 Thread JonStark
Is there a way to simply make a refresh button with Js helper so it does not refresh the page/a div in the page ? Similar than what Ajax painator button "first" does ? But on a content with no pagination ? Thanks a lot for your time. -- Our newest site for the community: CakePHP Video Tutoria

Re: One model, multiple pagination in a single view with conditions?

2012-06-26 Thread JonStark
I don't think it's possible with cake. Le mardi 26 juin 2012 05:41:16 UTC+2, 42startups a écrit : > > As the title suggests, is there a simple way to do this? > > Or should I create a separate model? > > Here's the code: > > $this->paginate = array('limit'=>30); > $this->Hashtag->Pin->bindModel(a

Re: Pagination with HABTM?

2012-06-25 Thread JonStark
; $data = $this->paginate('Post'); $this->set('posts', $data); Hope it helped Le lundi 25 juin 2012 03:14:32 UTC+2, 42startups a écrit : > > Ah ok, so how would I paginate and limit results to 10?... > > $this->loadModel('Tag', $id); > $tag =

Re: Pagination with HABTM?

2012-06-24 Thread JonStark
I find it easier to use LoadModel to display and sort posts from HABTM... Le dimanche 24 juin 2012 10:40:04 UTC+2, 42startups a écrit : > > Wow, CakePHP really hasn't got this problem sorted. > > After hours of searching I came across the solution below (which may or > may not be outdated), but I

Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
ned" this looks like > jquery not loaded error… > > I would put jquery at the top inside > https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"</a>; > type="text/javascript"> > > Andras Kende > http://www.kende.com > > >

Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
nd("click", function (event) {$.ajax({ beforeSend:function(XMLHttpRequest) {$("#busy-indicator").fadeIn();}, complete:function(XMLHttpRequest, textStatus) {$("#busy-indicator") .fadeOut();}, dataType:"html", evalScripts:true, success:function (data,

Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
'fadeOut', array('buffer' => false)), )); ?> Paginator->hasPage(2)) { echo $this->Paginator->prev(); echo (" | "); } ?> Paginator->numbers(); ?> Paginator->hasPage(2)) { echo (" | "); echo $this->Pag

Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
No one has a clue ? This is driving me crazy. Thanks a lot. Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit : > > I don't understand why ajax pagination won't work on my app. > > In my Users controller : > > > class UsersController extends AppContro

Re: $this->loadModel and performance

2012-06-22 Thread JonStark
der' => array( > 'Post.created' => 'ASC' > ), > 'limit' => 100, > 'maxLimit' => 100 > ); > $posts = $this->paginate($this->User->Post); > $this->set(compact('posts')); > > check the sql and p

Ajax Pagination not working ?

2012-06-22 Thread JonStark
I don't understand why ajax pagination won't work on my app. In my Users controller : class UsersController extends AppController { > public $name = 'Users'; > public $helpers = array('Html', 'Form', 'Paginator', '*Js*'); > public $components = array('*RequestHandler*'); In my layout : >

$this->loadModel and performance

2012-06-22 Thread JonStark
Even when having relationships (hasMany and such) implemented, I feel the need to user $this->loadModel to display related data. Indeed, when a User has 450 posts, there is a need to limit the number of associated data returned. But when I want to paginate all posts for a user profile, I use $t

Re: Jquery mobile+Phonegap mobile app and authentication

2012-06-21 Thread JonStark
I can't help you, but was wondering exactly the same. Le mardi 19 juin 2012 00:05:46 UTC+2, Arash a écrit : > > Hi, > We are working on a mobile app for our SAAS website which uses Cake 1.3, > we've decided to use Jquery mobile+ Phonegap so we will use the HTML5 power > for building a mobile app

Re: Count (return as a number) associated data.

2012-06-20 Thread JonStark
;dependent' => true ) ); and > Let's say USer hasMany Post. > > If i debug my user it will produce an array like : > > User > > Le mardi 19 juin 2012 00:21:25 UTC+2, JonStark a écrit : > > Let's say USer hasMany Post. > > If

Re: Count (return as a number) associated data.

2012-06-20 Thread JonStark
take I'm making ? * * Le mardi 19 juin 2012 00:21:25 UTC+2, JonStark a écrit : > > Let's say USer hasMany Post. > > If i debug my user it will produce an array like : > > User > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org

Re: Count (return as a number) associated data.

2012-06-18 Thread JonStark
7;Post' => array( (int) 0 => array( 'id' => '36', 'user_id' => '2', (...) ) ), How can I display the number of Posts this user have ? (in this examp

Count (return as a number) associated data.

2012-06-18 Thread JonStark
Let's say USer hasMany Post. If i debug my user it will produce an array like : User -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To

Re: Associate an array with a variable ?

2012-06-18 Thread JonStark
Seems to work perfectly, Thanks a lot ! Le lundi 18 juin 2012 17:26:21 UTC+2, JonStark a écrit : > > Here is the function I use to display posts that have a User.id equal to > $id : > > Code: php > >1. $data = $this->paginate('Post', array

Re: Associate an array with a variable ?

2012-06-18 Thread JonStark
You mean something like this ? $id = $myArray; $this->paginate = array('Post' => array('conditions' => array('User.id' => $id))); $data = $this->paginate('Post'); $this->set('posts', $data); ? Many thanks

Associate an array with a variable ?

2012-06-18 Thread JonStark
Here is the function I use to display posts that have a User.id equal to $id : Code: php 1. $data = $this->paginate('Post', array ( 2. 'User.id' => $id, 3. ) 4. ); 5. $this->set('posts', $data) I have an array pro

Re: Return a certain value from an array

2012-06-18 Thread JonStark
It worked like a charm, thanks a lot ! Le lundi 18 juin 2012 13:34:03 UTC+2, JonStark a écrit : > > Lets say this is my array : > > array( > (int) 0 => array( > 'UsersUser' => array( > 'id' =>

Re: Check table for a particular entry

2012-06-18 Thread JonStark
Damn, really stuck with this, any idea ? Many thanks ! Le jeudi 14 juin 2012 14:40:16 UTC+2, JonStark a écrit : > > I have a table with the following fields : > > id follower_id following_id > > So when a user clicks "follow" on an other user's profile, an entry

Re: Check table for a particular entry

2012-06-17 Thread JonStark
o find which Set:: to use : Indeed, I just have to check if any array contains a 'follower_id' wich is equal to $this->Session->read('Auth.User.id <http://auth.user.id/>'), and if so, return the associated 'id' value. (wich will be passed to the delet

Re: Check table for a particular entry

2012-06-16 Thread JonStark
7;hidden', 'value' => $user['User']['id'], )); echo (""); ?> Only need to code the "unfollow" form now I guess, wich lead me to my initial question I guess, how can I locate and delate the database entry ? Should look like this for exa

Re: Check table for a particular entry

2012-06-16 Thread JonStark
I tried this, it's actually clever, but there's a flaw I guess. Since the extract is done when logging in, the follow link will still appear for all the users you will follow after, and disappear only when re-logging in. Le jeudi 14 juin 2012 14:40:16 UTC+2, JonStark a écrit : &g

Re: Check table for a particular entry

2012-06-15 Thread JonStark
p follow } else { //follow } } Many thanks for your time. Le jeudi 14 juin 2012 14:40:16 UTC+2, JonStark a écrit : > > I have a table with the following fields : > > id follower_id following_id > > So when a user clicks "follow" on an other user's profi

Re: Check table for a particular entry

2012-06-15 Thread JonStark
ollowing already"); } else { echo("not following."); } ?> Any idea ? Le jeudi 14 juin 2012 14:40:16 UTC+2, JonStark a écrit : > > I have a table with the following fields : > > id follower_id following_id > > So when a user clicks "follow" on an

Re: Check table for a particular entry

2012-06-14 Thread JonStark
00-00-00 00:00:00', > > 'UsersUser' => array( > > 'id' => '24', > > 'follower_id' => '1', > > 'following_id&#x

Re: Check table for a particular entry

2012-06-14 Thread JonStark
To match if* Le jeudi 14 juin 2012 14:40:16 UTC+2, JonStark a écrit : > > I have a table with the following fields : > > id follower_id following_id > > So when a user clicks "follow" on an other user's profile, an entry like > this is created : > >

Re: Check table for a particular entry

2012-06-14 Thread JonStark
'follower_id' => '1', 'following_id' => '3' ) ) ), 'Follower' => array( (int) 0 => array( 'password' =

Re: Check table for a particular entry

2012-06-14 Thread JonStark
;=>array('UsersUsers')),false); > if ($this->User->UsersUsers->save($this->request->data)) { > $this->Session->setFlash('You are now following this user.'); > $this->redirect(array('controller' => 'users', 'act

Re: Check table for a particular entry

2012-06-14 Thread JonStark
27;Follower' => array( (int) 0 => array( 'password' => '*', 'id' => '2', 'username' => 'anotertest', &#

Check table for a particular entry

2012-06-14 Thread JonStark
I have a table with the following fields : id follower_id following_id So when a user clicks "follow" on an other user's profile, an entry like this is created : 15 1 3 meaning user with id 1 follows user with id 3. If user 3 follows 1, then an entry like 16 3 1 is created. But, in orde

RequestHandler problem (isXml and isRss)

2012-05-10 Thread JonStark
I have a problem with my XML simtemap. It should display ALL posts permalinks, but it takes into account paginator instead... What am I doing wrong ? : class PostsController extends AppController { > > public $name = 'Posts'; > > public $helpers = array('Html', 'Form', 'Paginator', 'Text');

Re: Two different urls parameters for the same page ?

2012-05-09 Thread JonStark
gt; $id > ) > ), > )); > $this->set(compact('user')); > } Le mercredi 9 mai 2012 12:50:16 UTC+2, JonStark a écrit : > > Hello everyone, > > I have a simple question : > > In my app, I use router + controller to get url like this : >

Two different urls parameters for the same page ?

2012-05-09 Thread JonStark
Hello everyone, I have a simple question : In my app, I use router + controller to get url like this : /profile/HASH ( myapp.com/profile/hgv5435634vfhcfg6YVC4 ) Routes : Router::connect('/profile/:hash', array('controller' => 'users', 'action' > => 'view'), array('pass' => array('hash')));

Re: Get the first link of a post ?

2012-05-03 Thread JonStark
Yes, I guess it would be $post[Post]['body'] Le vendredi 27 avril 2012 09:45:27 UTC+2, Mike Griffin a écrit : > > On Thu, Apr 26, 2012 at 17:53, JonStark wrote: > > I'm currently trying to get the first link of a post for a specific post > > format, but preg

Re: Looping through associated data (hasMany)

2012-05-01 Thread JonStark
Thanks a lot ! I'm new to php so I didn't understood how "as $post" worked. Many thanks ! Le mardi 1 mai 2012 13:11:53 UTC+2, JonStark a écrit : > > So I'm currently configuring my model relationship, and the array returns > all needed info. > > But I ha

Re: Looping through associated data (hasMany)

2012-05-01 Thread JonStark
27;0'] thing. How can I bypass this ? If I remove it, it says Undefined index: title ... I wan to display all the titles of the owned posts... Thanks for your time. Le mardi 1 mai 2012 13:11:53 UTC+2, JonStark a écrit : > > So I'm currently configuring my model relationship, and t

Looping through associated data (hasMany)

2012-05-01 Thread JonStark
So I'm currently configuring my model relationship, and the array returns all needed info. But I have question : On my app, User hasMay Post, and so arrays look like this on User/view.ctp : array( > 'User' => array( > 'password' => '*', > 'id' => '1', >

Re: Saving HABTM erases existing records...

2012-05-01 Thread JonStark
I tried with 'unique' => false, It doesn't erase previous ones, but I can follow the same user many times, so it's not that. And keepExisting seems to wrok exactly the same as 'unique' => true ... Le mardi 1 mai 2012 12:02:08 UTC+2, JonStark a écrit :

Re: Saving HABTM erases existing records...

2012-05-01 Thread JonStark
I justs checked that out, but how can I change this behaiour ? Le mardi 1 mai 2012 12:02:08 UTC+2, JonStark a écrit : > > Hello, > > I currently having a problem achieving a follower system with HABTM. > > In a word, my relationships seem to be well set up : > > User HA

Saving HABTM erases existing records...

2012-05-01 Thread JonStark
Hello, I currently having a problem achieving a follower system with HABTM. In a word, my relationships seem to be well set up : User HABTM Follower , and in my join table (users_uers) I have the tables ID (auto increment) user_id and follower_id I have a button "follow this user" : > > >

Re: Hide "previous" "next" when no pagination

2012-04-27 Thread JonStark
->Paginator->next(); } ?> Le jeudi 26 avril 2012 18:17:49 UTC+2, JonStark a écrit : > > How can I hide the "<< Previous Next >>" that appears if there is no > pages to paginate ? > I think this is possible because the numbers do not appear when not need

Get the first link of a post ?

2012-04-26 Thread JonStark
I'm currently trying to get the first link of a post for a specific post format, but preg_match needs two parameters and I can't find the second... Here is my code : (...) } else if (($post['Post']['format']) == 'link') { if (preg_match('/]*?href=[\'"](.+?)[\'"]/is')a) { return $firstLink; } el

Hide "previous" "next" when no pagination

2012-04-26 Thread JonStark
How can I hide the "<< Previous Next >>" that appears if there is no pages to paginate ? I think this is possible because the numbers do not appear when not needed. Thanks a lot ! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Que

Re: Reset Debugger::checkSecurityKeys();

2012-04-21 Thread JonStark
No one has an idea ? Thanks a lot. Le vendredi 20 avril 2012 18:09:07 UTC+2, JonStark a écrit : > > Hello, > > I'm develloping an open source CMS with very basic install. > > For developping purpose, I changes the keys to install cakephp. > > But when a user downlo

Reset Debugger::checkSecurityKeys();

2012-04-20 Thread JonStark
Hello, I'm develloping an open source CMS with very basic install. For developping purpose, I changes the keys to install cakephp. But when a user downloads the CMS, I want him to be prompted to change those keys with this code : 0): Debugger::checkSecurityKeys(); endif; ?> But how can I re

Re: Site wide settings with Configure::write and read

2012-04-11 Thread JonStark
ting['Setting']['value']; foreach($settings as $setting): Configure::write($settingName, $settingValue); endforeach; } Any idea ? Le mercredi 11 avril 2012 13:33:07 UTC+2, JonStark a écrit : > > Hello. > > I'm currently trying to achieve edit

Site wide settings with Configure::write and read

2012-04-11 Thread JonStark
Hello. I'm currently trying to achieve editable site-wide setting for my website with Configure::write and read. My db had id, name and value (ex: 1, site.name, My site) I have this function in AppController : function fetchSettings(){ //Loading model on the fly $this->loadModel(

Re: $condition and OR

2012-04-09 Thread JonStark
Thanks a lot, it worked ! Le lundi 9 avril 2012 12:22:56 UTC+2, JonStark a écrit : > > Hello every one. > > I'm stuck with a little piece of code : > > $condition = array('User.role' =>* 'admin'||'author')*; > $this->set('

$condition and OR

2012-04-09 Thread JonStark
Hello every one. I'm stuck with a little piece of code : $condition = array('User.role' =>* 'admin'||'author')*; $this->set('users', $this->paginate('User', $condition)); It seems that OR (*||) *Isn't working with array... but I have a 3 role blog, and I want to regroup authors and admins o

Convert the content of a form from Markdown to HTML

2012-03-25 Thread JonStark
Hi ! In my app I have a simple form : Add an article Form->create('Post', array( 'class' => 'form', 'inputDefaults' => array( 'div' => 'control-group', 'label' => false, 'between' => '', 'after' => '', 'error' => array('attributes' => array('wrap' => 'div', 'class' => 'ale

Re: Cake 2.0.4 : how to display "logout" if logged, else display "login"

2011-12-24 Thread JonStark
Indeed, stupid mistake... Thanks again ! I need to be more careful. This works : Html->url('/items/add'); if ($this->Session->check('Auth.User.id')) { echo (" Add an activity

Re: Cake 2.0.4 : how to display "logout" if logged, else display "login"

2011-12-23 Thread JonStark
"); } ?> I'm sorry if this code looks supid, I'm completely new to cakephp, and more generally php ! On 23 déc, 20:42, JonStark wrote: > Thanks a lot ! Now it works, and more importantly I understand why ! > Thanks a lot for your ti

Re: Cake 2.0.4 : how to display "logout" if logged, else display "login"

2011-12-23 Thread JonStark
; > > > > > > > ok, that makes sense. > > no - the method call stays the same! > > > btw: > > most cake developers would check on the id specifically: > > > if ($this->Session->check('Auth.User.id')) {} > > > On 23 Dez., 19:51,

Re: Cake 2.0.4 : how to display "logout" if logged, else display "login"

2011-12-23 Thread JonStark
? Thanks a lot for your help ! On 23 déc, 19:41, euromark wrote: > $session was already outdated in 1.3 > > $this->Session is the correct usage > > On 23 Dez., 17:26, JonStark wrote: > > > > > > > > > I want to do this on cake 2.0.4 (new

Cake 2.0.4 : how to display "logout" if logged, else display "login"

2011-12-23 Thread JonStark
I want to do this on cake 2.0.4 (new to cake), but this does'nt work: read('Auth')) { echo("logged"); } else { echo("not logged"); } ?> Thanks a lot for your help ! -- Our newest site for the community: