Re: Loading element on-the-fly in article/posts with bbcode

2013-11-22 Thread MetZ

>
> Small update, I did some coding here, not sure if I am moving in the right 
> direction.. Suggestions on how to return the element
>

Shortcodehelper.php:
App::import('Helper', 'Html', 'Router');
class ShortcodeHelper extends AppHelper {
public $shortcodes = array( 
'slideshow' => '/(\[slideshow=)(.+?)(\])(.+?)(\[\/slideshow\])/'
); 
public $returncodes = array( 
//'slideshow' => $this->render('/elements/slideshow', array('id'=>'\\2'))
'slideshow' => '\\4' 
); 
  
public function render($content, $render=null) {
$shortcodes = $this->shortcodes;
$returncodes = $this->returncodes;
if(isset($render)) {
$temp_shortcodes = array(); 
$temp_returncodes = array(); 
foreach ($render as $key => $value) { 
$temp_shortcodes[$key] = $shortcodes[$value]; 
$temp_returncodes[$key] = $returncodes[$value]; 
} 
$returncodes = $temp_returncodes; 
$shortcodes = $temp_shortcodes; 
 }
$return = preg_replace($shortcodes, $returncodes,  $content); 
return $this->output($return); 
}
}

view.ctp:
Shortcode->render($page['Page']['body']); ?>

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

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


Loading element on-the-fly in article/posts with bbcode

2013-11-22 Thread MetZ
Hi all.

I am wondering, does anyone have a suggestion on how to approach loading of 
element in regular posts?

I am looking at "BBCODE style" loading of element to display example a 
slideshow.

example; I need to load slideshow with id=1 in my post. I have an element, 
load-slideshow.ctp where I can insert id, and correct slideshow loads.

Now, I want to be able to load, in my wysiwyg editor, [Slideshow=1]my 
awesome slideshow[/Slideshow], and this load the element and display the 
slideshow.

Any suggestions how to do this? Howtos or any other suggestion? 

Thanks!

-Tom

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

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


Re: Saving geolocation data to session with timeout or better approach?

2013-08-17 Thread MetZ
oh, and using latest cake 2.3.8 or soemting like 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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Saving geolocation data to session with timeout or better approach?

2013-08-17 Thread MetZ
Hi all.

I have a script that retrieves some location data from google api, and 
store the retrieved data in a Session (Location). All this is working just 
fine :) 
(if someone have a better way, better approach to store this data for my 
website visitors, let me know).

The data is saved to session (as of now), with an ajax call from the script.

example in controller for Geolocation.Lat:
*if ($this->request->data['lat'] != "") {*
* $this->Session->write('Location.lat', $this->request->data['lat']); *
*}*
(the other values are also stored similar; Location.long,Location.city and 
so on).

Now, I am wondering, how can I set a timeout on the session => Location.*

I want the visitors location data to be valid for, example 1 hour, before 
requesting new geolocation. 

Any suggestion how and where to store the data (the best approach) ??

Thanks for any input on this :)


-Tom

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

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


Using variable from controller in model

2013-01-29 Thread MetZ
Hi all.

I am struggling passing a variable to my before save function in my User 
model.

Controller:
$this->User->read(null, $data['user_id']);
$this->User->set(array(
'noslug' => 1,
'TEST' => 'sdfsd'
));
$this->User->save();

Model:

if(empty($this->data[$this->alias]['noslug']) {
  // noslug empty, do somthing cool
} else {
  // noslug not empty, do something else
}


$this->data[$this->alias]['noslug'] = always empty/false

How can I read the "noslug" = 1 in my model?

Thanks for any help on this!
-Tom

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

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




Re: Load different config file

2013-01-19 Thread MetZ
I did it like this:

bootstrap.php

if (isset($_SERVER['SERVER_NAME'])) {
$tld = strrchr($_SERVER['SERVER_NAME'], ".");
$tld = substr ($tld, 1);
}
if (!empty($tld)) {
if ($tld == 'se') {
Configure::load('config_se');
}
elseif ($tld == 'dk') {
Configure::load('config_dk');
} else {
Configure::load('config_no');
}
} else {
Configure::load('config_no');
}

Anyone have any suggestions on a better approach?


kl. 18:19:07 UTC+1 fredag 18. januar 2013 skrev Andras Kende følgende:
>
> I guess you could do something like: 
>
> bootstrap.php 
>
> $tld = strrchr($_SERVER['SERVER_NAME'], '.'); 
> Configure::load('config' . $tld); 
>
> or with parse_url or regex. 
>
> Andras Kende 
> http://www.kende.com 
>
>
> On Jan 18, 2013, at 7:08 AM, MetZ > wrote: 
>
> > Hi.. 
> > 
> > I am wondering the best approach to load different config files 
> according to TLD? 
> > 
> > domain.TLD1 
> > domain.TLD2 
> > domain.TLD3 
> > 
> > config/config_TLD1.php 
> > config/config_TLD2.php 
> > config/config_TLD3.php 
> > 
> > Today I am using only the config_TLD1.php (loaded in bootstrap). 
> > 
> > Any suggestions? 
> > 
> > Thanks! 
> > -Tom 
> > 
> > -- 
> > 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.




Load different config file

2013-01-18 Thread MetZ
Hi..

I am wondering the best approach to load different config files according 
to TLD?

domain.TLD1
domain.TLD2
domain.TLD3

config/config_TLD1.php
config/config_TLD2.php
config/config_TLD3.php

Today I am using only the config_TLD1.php (loaded in bootstrap).

Any suggestions?

Thanks!
-Tom

-- 
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: Advanced find with mulitple OR/WHERE/AND conditions

2013-01-16 Thread MetZ
SELECT COUNT(*) AS `count` FROM `DATABASE`.`app_items` AS `Item` WHERE 
`Item`.`published` = '1' AND ((`Item`.`start_date` BETWEEN '2013-01-16 
00:00' AND '2013-01-16 23:59') OR (`Item`.`end_date` BETWEEN '2013-01-16 
00:00' AND '2013-01-16 23:59') OR 
(FIND_IN_SET('search_word',`Item`.`location_start`)) OR 
(FIND_IN_SET('second_search_word',`Item`.`location_end`)))


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




Advanced find with mulitple OR/WHERE/AND conditions

2013-01-16 Thread MetZ
Hi all.. I am looking to do a search for ITEMS with mulitple conditions.

1 = location_start
2= location_end
3=start_date
4=end_date

Here is what I have this far:

$start_date = date("Y-m-d 00:00");
$end_date = date("Y-m-d 23:59");

$conditions = array(
'Item.published' => 1,
"OR" => array(
array('Item.start_date BETWEEN ? AND ?' => 
array($start_date,$end_date)),
array('Item.end_date BETWEEN ? AND ?' => 
array($start_date,$end_date)),
array('FIND_IN_SET(\''. 
$this->request->data['Search']['location_from'] .'\',Item.location_start)'),
array('FIND_IN_SET(\''. 
$this->request->data['Search']['location_to'] .'\',Item.location_end)')
)
);


I can not seem to get the selection according to the dates going.
Finding the items that have set dates between start_date and end_date.

Item.start_date & Item.end_date are stored in db like this: Y-m-d H:i

Any suggestions

-Tom

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




How can I render an element after pageload?

2013-01-13 Thread MetZ
Okei. here goes.

I have an element (test_element.ctp), that perform an API call.

I use a regular: echo $this->element('test_element', array("limit" => 2));
to load it:


element('test_element', array("limit" => 2)); ?>


So far so good. The element load API call and display data as it should.. 

Now to my question, HOW can I make a jquery/ajax approach, to display 
loading icon until the API call/rendering inside the element is done, and 
then update the div with the finished data? 

So that my website will load everything else on the site and display the 
api data when the element is finished loading in the background??

Now the rest of my website content will need to wait for the element to 
finish talking to the API before displaying the page..

Anyone know of a good approach to this?

Thanks!
-Tom


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




Need some HABTM help retrieving related posts

2012-12-16 Thread MetZ
Okei, so I have a HABTM setup:
- posts
- tags
- posts_tags

When creating posts => select multiple tags: example: Tag1, Tag2, Tag3

Each selected tag is saved to posts_tags: id:1, post_id: 44, tag_id: 3 
 (and so on).

Now, displaying my posts, and listing the selected tags, is no problem. 
Everything is working flawlessly. 

However, I would like to have widget "You might also like these posts" => 
list 5 posts with similar content (using the same tags as the post beeing 
read).

So here I came across some difficulty finding similar posts according to 
selected tags.

Example: Is *Post.id = 44 * (beeing read) have *Tag.id = 1, 3 ,4 *assigned

How can I retrieve *5 other posts* that have the same *Tag.id assigned*, 
and *exclude the Post.id beeing read* from the find??

I guess I will need to use some kind of join/grouping, but I am a total 
noob regarding those things, so any help on this will be GREATLY 
appreciated!!

Thanks for your time!

-Tom

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




Cake and paypal subscription/reccuring payment plans

2012-12-01 Thread MetZ
Hi.

Anyone with any experience with cakephp and paypal recurring/subscription 
payments?
Tried google and reading alot about subject, but if anyone know of any good 
guides, or know how to do it (have experience with similar setups) I will 
appreciate all help and suggestions on this :)

I have a member section with type 1 and 2

If type 2 = user need to subscribe monthly payment (fixed cost).
if type = 1 it is free.

So I am looking into how to implement this on cakephp framework. 

1: How to set value to db that user subscription is valid = payment is 
beeing processed as it should
like if for some reason a subsciption is invalid (card not valid anymore or 
something) correct value is set to db.

2: How to implement a Cancel subscription with a link from website

3: Make it possible to subscibe without a paypal account

As always.. You bakers are awesome for you time spent on helping others =)

Thanks!!!
-Tom

-- 
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: send emails

2012-11-25 Thread MetZ
Emails:
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html

Google Maps:
http://stackoverflow.com/questions/8795104/google-map-v3-cakephp-helper-and-multiple-markers

-- 
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: User login after register does not work

2012-11-25 Thread MetZ
Hey..

Try this:

 if ($this->User->save($this->request->data)) {
if ($this->Auth->login($this->request->data['User'])) {
$this->redirect($this->Auth->redirect());


Or you can find the user and log him in after the save:

$user = $this->User->findById($this->User->getInsertID());
if ($user) {
  $this->Auth->login($user['User'])
}


-Tom


kl. 12:15:19 UTC+1 fredag 23. november 2012 skrev alex sandor følgende:
>
> Hello,
> in my opinion website usability wants me to log in my users right after 
> registration. It makes no sense to force them to reenter their log in 
> information after they already filled out the registration 
> form successfully.
>
> public function signup() {
> if ($this->request->is('post')) {
> $this->User->create();
> if ($this->User->save($this->request->data)) {
> if ($this->Auth->login()) {
> $this->redirect($this->Auth->redirect());
> } else {
> $this->Session->setFlash(__('The user could not be saved. 
> Please, try again.'));
> }
> }
> }
> In this code $this->Auth->login() just returns false. The User is saved 
> correctly however.
>
> public function signup() {
> if ($this->request->is('post')) {
> $this->User->create();
> if ($this->User->save($this->request->data)) {
> if ($this->Auth->login($this->request->data)) {
> $this->redirect($this->Auth->redirect());
> } else {
> $this->Session->setFlash(__('The user could not be saved. 
> Please, try again.'));
> }
> }
> }
> In this code the Auth and the Session only contains field that are also in 
> $this->request->data, but not other fields of User like "id".
>
> Both examples above do not do what i want. I need ALL fields of User right 
> after registration/signup, including "id" and others.
>
> My view(parsed) looks like this:
>  method="post" accept-charset="utf-8"> type="hidden" name="_method" value="POST"/>   
> Name name="data[User][name]"maxlength="255" type="text" id="UserName"/>
> Email maxlength="250" type="text" id="UserEmail"/>
> Passwort name="data[User][password]" type="password" id="UserPassword"/>
> Passwort name="data[User][password_confirm]" type="password" 
> id="UserPasswordConfirm"/>
> Sign Up   
> 
>
> And last but not least in my AppController:
> public $components = array(
> 'Session',
> 'Auth' => array(
> 'loginRedirect' => array('controller' => 'users', 'action' => 
> 'settings'),
> 'logoutRedirect' => array('controller' => 'pages', 'action' => 
> 'display', 'home'),
> 'authenticate' => array(
> 'Form' => array(
> 'fields' => array('username' => 'email')
> )
> )
> )
> );
>

-- 
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: Auth allow for shared functions in Appcontroller

2012-11-23 Thread MetZ
Like this:  

*AppController*

public $components = array(
'Acl',
'Auth' => array(
'loginAction' => '/',
'loginRedirect' => '/users/dashboard',
'logoutRedirect' => 
array('admin'=>false,'controller'=>'pages','action'=>'home'),
'autoRedirect'   => false,
'authorize' => array(
'Actions' => array(
'actionPath' => 'controllers'
)
),
'authError' => 'No access',
),
'Session',
'Security',
'Cookie'
);

public function beforeFilter() {
  // unquoting this line will cause App to crash
  // $this->Auth->allow('TellaFriend')
}

*PageController*

public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('home','view');
}

And using cake 2.3 beta

So? Doing anything wrong?

-Tom

kl. 20:20:52 UTC+1 fredag 23. november 2012 skrev cricket følgende:
>
> On Fri, Nov 23, 2012 at 5:37 AM, MetZ > 
> wrote: 
> > 
> > So, what to put where? 
> > 
> > eg: PageController 
> > $this->allowedActions = array_merge($this->allowedActions, $args); 
>
> No, no. This line is from AuthComponent. I just mentioned it to point 
> out that calling allow() in AppController *and* your regular 
> controller should work just fine. 
>
> So how are you initialising Auth? In the $components array or in 
> beforeFilter()? 
>
> What you want to do is possible so you've probably either got 
> something misconfigured somewhere or you're calling something 
> where/when you shouldn't be. 
>

-- 
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: Auth allow for shared functions in Appcontroller

2012-11-23 Thread MetZ
and running cake 2.3


kl. 11:37:21 UTC+1 fredag 23. november 2012 skrev MetZ følgende:
>
> Hey Cricket.. 
>
> Yes I am loading auth like you said in AppController :)
>
> So, what to put where? 
>
> eg: PageController
> $this->allowedActions = array_merge($this->allowedActions, $args); 
>
> AppController
>  ???
>
> not 100% sure how you are doing it.. :)
>
> Thanks for your time!!!
>
> --Tom
>
> kl. 00:04:49 UTC+1 fredag 23. november 2012 skrev cricket følgende:
>>
>> Ignore what I said. I just thought about it for a minute and that's 
>> incorrect. Auth::allow merges the actions: 
>>
>> $this->allowedActions = array_merge($this->allowedActions, $args); 
>>
>> So when it runs in a given Controller the other actions are merged 
>> with whatever you allow in AppController. I just removed an action 
>> from one of mine and allow()ed it inAppController. Works just fine. 
>>
>> What version are you running? 
>>
>> And I assumed you initialised Auth in AppController's $components array. 
>> eg. 
>>
>> public $components = array( 
>> 'Auth' => array( 
>> 'loginAction' => array( 
>> 'admin' => 0, 'controller' => 'users', 'action' 
>> => 'login' 
>> ), 
>> // etc. 
>>
>> If you don't do it that way you need to initialise in beforeFilter() 
>> *before* you call Auth::allow(). 
>>
>> On Thu, Nov 22, 2012 at 5:48 PM, lowpass  wrote: 
>> > When AppController::beforeFilter() runs, it knows only about the 
>> > methods in AppController. 
>> > 
>> > If you want to have dedicated actions for each controller then you 
>> > need to specifically allow() them in each controller. Your controller 
>> > action might in turn call parent::TellAFriend() which is a method in 
>> > AppController, but Auth won't care about that. The only thing that 
>> > matters in terms of whether you can call it is that it's not a private 
>> > method. Auth only handles actions that Dispatcher dispatches to. 
>> > 
>> > 
>> > On Thu, Nov 22, 2012 at 3:01 PM, MetZ  wrote: 
>> >> Hi. 
>> >> 
>> >> I have a function in my AppController = TellaFriend 
>> >> 
>> >> That allows a visitor to email his friend about a spesific page on the 
>> >> website, eg: shared by all controllers 
>> >> 
>> >> Now, if I need to have the function available to my views using 
>> >> PostsController, I need to put in Auth allow TellaFriend in 
>> Postscontroller. 
>> >> And if I need it in PageController, I need to put in Auth allow 
>> TellaFriend 
>> >> in Pagecontroller also, and so on. 
>> >> 
>> >> Since this is a shared function, I was wondering, is it possible to 
>> add it 
>> >> to AppController, and have it available app-wide? 
>> >> I refer to my first post for the basic controller setup in use today 
>> (except 
>> >> anything Auth allow in AppController, If I put anything like the 
>> mentioned 
>> >> string in AppController, App does not work at all). 
>> >> 
>> >> -Tom 
>> >> 
>> >> 
>> >> kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: 
>> >>> 
>> >>> He means that he wants his AppController actions Auth::allow()ed 
>> globally. 
>> >>> 
>> >>> I've never run into this personally; don't know if it's a bug. Are 
>> >>> these *actions* or just global functions that your controllers call 
>> >>> internally? The latter I've done many times. There's no need to allow 
>> >>> them as they're not actions that Dispatcher is involved with. 
>> >>> 
>> >>> It can be an array or multiple strings, btw. 
>> >>> 
>> >>> On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit 
>> >>>  wrote: 
>> >>> > I hope I haven't misunderstood what you are trying to do... If they 
>> are 
>> >>> > shared functions just put and allow them in app controller and call 
>> them 
>> >>> > from any other controller like so: $this->myFunctionName(). 
>> >>> > 
>> >>> > On 22 Nov 2012, at 16:04, MetZ  wr

Re: Auth allow for shared functions in Appcontroller

2012-11-23 Thread MetZ
Hey Cricket.. 

Yes I am loading auth like you said in AppController :)

So, what to put where? 

eg: PageController
$this->allowedActions = array_merge($this->allowedActions, $args); 

AppController
 ???

not 100% sure how you are doing it.. :)

Thanks for your time!!!

--Tom

kl. 00:04:49 UTC+1 fredag 23. november 2012 skrev cricket følgende:
>
> Ignore what I said. I just thought about it for a minute and that's 
> incorrect. Auth::allow merges the actions: 
>
> $this->allowedActions = array_merge($this->allowedActions, $args); 
>
> So when it runs in a given Controller the other actions are merged 
> with whatever you allow in AppController. I just removed an action 
> from one of mine and allow()ed it inAppController. Works just fine. 
>
> What version are you running? 
>
> And I assumed you initialised Auth in AppController's $components array. 
> eg. 
>
> public $components = array( 
> 'Auth' => array( 
> 'loginAction' => array( 
> 'admin' => 0, 'controller' => 'users', 'action' => 
> 'login' 
> ), 
> // etc. 
>
> If you don't do it that way you need to initialise in beforeFilter() 
> *before* you call Auth::allow(). 
>
> On Thu, Nov 22, 2012 at 5:48 PM, lowpass > 
> wrote: 
> > When AppController::beforeFilter() runs, it knows only about the 
> > methods in AppController. 
> > 
> > If you want to have dedicated actions for each controller then you 
> > need to specifically allow() them in each controller. Your controller 
> > action might in turn call parent::TellAFriend() which is a method in 
> > AppController, but Auth won't care about that. The only thing that 
> > matters in terms of whether you can call it is that it's not a private 
> > method. Auth only handles actions that Dispatcher dispatches to. 
> > 
> > 
> > On Thu, Nov 22, 2012 at 3:01 PM, MetZ > 
> wrote: 
> >> Hi. 
> >> 
> >> I have a function in my AppController = TellaFriend 
> >> 
> >> That allows a visitor to email his friend about a spesific page on the 
> >> website, eg: shared by all controllers 
> >> 
> >> Now, if I need to have the function available to my views using 
> >> PostsController, I need to put in Auth allow TellaFriend in 
> Postscontroller. 
> >> And if I need it in PageController, I need to put in Auth allow 
> TellaFriend 
> >> in Pagecontroller also, and so on. 
> >> 
> >> Since this is a shared function, I was wondering, is it possible to add 
> it 
> >> to AppController, and have it available app-wide? 
> >> I refer to my first post for the basic controller setup in use today 
> (except 
> >> anything Auth allow in AppController, If I put anything like the 
> mentioned 
> >> string in AppController, App does not work at all). 
> >> 
> >> -Tom 
> >> 
> >> 
> >> kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende: 
> >>> 
> >>> He means that he wants his AppController actions Auth::allow()ed 
> globally. 
> >>> 
> >>> I've never run into this personally; don't know if it's a bug. Are 
> >>> these *actions* or just global functions that your controllers call 
> >>> internally? The latter I've done many times. There's no need to allow 
> >>> them as they're not actions that Dispatcher is involved with. 
> >>> 
> >>> It can be an array or multiple strings, btw. 
> >>> 
> >>> On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit 
> >>>  wrote: 
> >>> > I hope I haven't misunderstood what you are trying to do... If they 
> are 
> >>> > shared functions just put and allow them in app controller and call 
> them 
> >>> > from any other controller like so: $this->myFunctionName(). 
> >>> > 
> >>> > On 22 Nov 2012, at 16:04, MetZ  wrote: 
> >>> > 
> >>> > Hi. 
> >>> > 
> >>> > Anyone know how I can auth allow shared functions in appcontroller? 
> >>> > 
> >>> > Appcontroller: 
> >>> > public function beforeFilter() { 
> >>> > $this->Auth->allow('SharedFunction'); 
> >>> > 
> >>> > OtherController.php 
> >>> > public function beforeFilter() { 
>

Re: Auth allow for shared functions in Appcontroller

2012-11-22 Thread MetZ
Hi.

I have a function in my AppController = TellaFriend

That allows a visitor to email his friend about a spesific page on the 
website, eg: shared by all controllers

Now, if I need to have the function available to my views using 
PostsController, I need to put in Auth allow TellaFriend in Postscontroller.
And if I need it in PageController, I need to put in Auth allow TellaFriend 
in Pagecontroller also, and so on.

Since this is a shared function, I was wondering, is it possible to add it 
to AppController, and have it available app-wide?
I refer to my first post for the basic controller setup in use today 
(except anything Auth allow in AppController, If I put anything like the 
mentioned string in AppController, App does not work at all).

-Tom


kl. 20:33:21 UTC+1 torsdag 22. november 2012 skrev cricket følgende:
>
> He means that he wants his AppController actions Auth::allow()ed globally. 
>
> I've never run into this personally; don't know if it's a bug. Are 
> these *actions* or just global functions that your controllers call 
> internally? The latter I've done many times. There's no need to allow 
> them as they're not actions that Dispatcher is involved with. 
>
> It can be an array or multiple strings, btw. 
>
> On Thu, Nov 22, 2012 at 11:09 AM, Jeremy Burns : Class Outfit 
> > wrote: 
> > I hope I haven't misunderstood what you are trying to do... If they are 
> > shared functions just put and allow them in app controller and call them 
> > from any other controller like so: $this->myFunctionName(). 
> > 
> > On 22 Nov 2012, at 16:04, MetZ > wrote: 
> > 
> > Hi. 
> > 
> > Anyone know how I can auth allow shared functions in appcontroller? 
> > 
> > Appcontroller: 
> > public function beforeFilter() { 
> > $this->Auth->allow('SharedFunction'); 
> > 
> > OtherController.php 
> > public function beforeFilter() { 
> > parent::beforeFilter(); 
> > $this->Auth->allow('ControllerSpesificFunction', 
> > 'ControllerSpesificFunction2'); 
> > 
> > If I do it like above, it kills my app, and to get the sharedfunction(s) 
> > access in all controllers, I need to manually put them in all 
> controllers. 
> > 
> > Anyone know how I can do it? 
> > 
> > Have tried with array() and so on. same result. 
> > 
> > Thanks! 
> > -Tom 
> > 
> > -- 
> > 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...@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.




Auth allow for shared functions in Appcontroller

2012-11-22 Thread MetZ
Hi.

Anyone know how I can auth allow shared functions in appcontroller? 

Appcontroller:
public function beforeFilter() {
$this->Auth->allow('SharedFunction');

OtherController.php
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('ControllerSpesificFunction', 
'ControllerSpesificFunction2');

If I do it like above, it kills my app, and to get the sharedfunction(s) 
access in all controllers, I need to manually put them in all controllers.

Anyone know how I can do it? 

Have tried with array() and so on. same result.

Thanks!
-Tom

-- 
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: I want to find records during last 24 hours

2012-08-21 Thread MetZ
YES!!

You are totally awesome! 

Looks like it returns the correct users now. I will do some testing.. 

Thanks alot!

Regards!

-Tom

kl. 20:25:11 UTC+2 tirsdag 21. august 2012 skrev MetZ følgende:
>
> Hi..
>
> No,, that one also return empty array :(
>
> Thanks anyway! any other suggestion?
>
> -Tom
>
>
> kl. 20:19:16 UTC+2 tirsdag 21. august 2012 skrev Mancho Murgan følgende:
>>
>> Try with this sintax:
>>
>> $users = $this->User->find('all', array('conditions' => 
>> array('User.last_seen BETWEEN NOW() AND NOW() -INTERVAL 1 DAY'), 
>> 'recursive' => -2);
>>
>> --
>> Murgan, Alexis Germán
>> Desarrollador & Diseñador
>> Web: german.murgan.com.ar
>> Email: ger...@murgan.com.ar
>> MSN: ger...@murgan.com.ar
>> Móvil: +5493424663813
>>
>>
>> 2012/8/21 MetZ 
>>
>>> How can I find the Users that are "last_seen" the last 24hours?
>>>
>>> [User][last_seen] => 2012-08-18 08:10:31
>>>
>>> last_seen is updated each time a logged in user browse the website with 
>>> current timestamp
>>>
>>> This is what I have tried this far:
>>>
>>> $users = $this->User->find('all',array('conditions'=>array('User.last_seen 
>>> >' =>'BETWEEN NOW() AND NOW()- INTERVAL 24 HOURS'),'recursive'=>-2));
>>>
>>> But my array is coming back empty.
>>>
>>> Suggestions??
>>>
>>> As always!! You are awesome! Thanks for your time!
>>>
>>> -Tom
>>>
>>> -- 
>>> 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-US.
>>>  
>>>  
>>>
>>
>>

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




Re: I want to find records during last 24 hours

2012-08-21 Thread MetZ
Hi..

No,, that one also return empty array :(

Thanks anyway! any other suggestion?

-Tom


kl. 20:19:16 UTC+2 tirsdag 21. august 2012 skrev Mancho Murgan følgende:
>
> Try with this sintax:
>
> $users = $this->User->find('all', array('conditions' => 
> array('User.last_seen BETWEEN NOW() AND NOW() -INTERVAL 1 DAY'), 
> 'recursive' => -2);
>
> --
> Murgan, Alexis Germán
> Desarrollador & Diseñador
> Web: german.murgan.com.ar
> Email: ger...@murgan.com.ar 
> MSN: ger...@murgan.com.ar 
> Móvil: +5493424663813
>
>
> 2012/8/21 MetZ >
>
>> How can I find the Users that are "last_seen" the last 24hours?
>>
>> [User][last_seen] => 2012-08-18 08:10:31
>>
>> last_seen is updated each time a logged in user browse the website with 
>> current timestamp
>>
>> This is what I have tried this far:
>>
>> $users = $this->User->find('all',array('conditions'=>array('User.last_seen 
>> >' =>'BETWEEN NOW() AND NOW()- INTERVAL 24 HOURS'),'recursive'=>-2));
>>
>> But my array is coming back empty.
>>
>> Suggestions??
>>
>> As always!! You are awesome! Thanks for your time!
>>
>> -Tom
>>
>> -- 
>> 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-US.
>>  
>>  
>>
>
>

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




I want to find records during last 24 hours

2012-08-21 Thread MetZ


How can I find the Users that are "last_seen" the last 24hours?

[User][last_seen] => 2012-08-18 08:10:31

last_seen is updated each time a logged in user browse the website with 
current timestamp

This is what I have tried this far:

$users = $this->User->find('all',array('conditions'=>array('User.last_seen >' 
=>'BETWEEN NOW() AND NOW()- INTERVAL 24 HOURS'),'recursive'=>-2));

But my array is coming back empty.

Suggestions??

As always!! You are awesome! Thanks for your time!

-Tom

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




Re: Elfinder 2.x integration with cakephp 2.x ?

2012-08-11 Thread MetZ
So.. After some messing around,, I figured out how to do it using the old 
1.x conncetors (probably not the best pratice, but it works).
If anyone want to know how I did it 
=> 
http://whatswhat.no/development/framework/cakephp-2/475-how-to-setup-and-use-elfinder-2-0-as-your-filemanager-in-cakephp-2-x

Also, If anyone have some imporvements to add, let me know.. 

Thanks anyway!

-Tom

kl. 02:07:21 UTC+2 lørdag 11. august 2012 skrev MetZ følgende:
>
> Hi all..
>
> I have been using the old Elfinder as my filemanager in my admin panel 
> (the v.1.somthing).
>
> Now, I am trying to implement the new Elfinder 2 to my admin panel, and 
> are experiencing some trouble. 
>
> mainly, I can not seem to get the connector going. I have created an 
> helper to load all JS to view, and tried to load the connector in my 
> controller.
>
> Any suggestions? Or perhaps you have this working on your projects?
>
> What is the best approach here? I am not to experienced with components 
> and such.. 
>
> Thanks for any help on this..
>
> Regards!
> -Tom
>

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




Re: gebo admin template

2012-08-11 Thread MetZ
Just a blog site.. and I did not have the time to build an app for it... =)

-Tom




kl. 05:36:48 UTC+2 lørdag 11. august 2012 skrev rchavik følgende:
>
> why is it running wordpress? :p
>
> On Saturday, August 11, 2012 7:03:24 AM UTC+7, MetZ wrote:
>>
>>
>> http://whatswhat.no/development/framework/cakephp-2/451-how-to-create-admin-panel-with-own-theme-in-cakephp
>>
>> Have fun :)
>>
>> kl. 15:17:32 UTC+2 torsdag 9. august 2012 skrev Rahul følgende:
>>>
>>> Hi,
>>>
>>> I am looking for some help to setup gebo admin template for my project, 
>>> please share any useful links/info  .
>>>
>>> gebo admin template is the paid one and help is required to port that 
>>> in  cakephp.
>>>
>>> Thanks,
>>>
>>>

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




Elfinder 2.x integration with cakephp 2.x ?

2012-08-10 Thread MetZ
Hi all..

I have been using the old Elfinder as my filemanager in my admin panel (the 
v.1.somthing).

Now, I am trying to implement the new Elfinder 2 to my admin panel, and are 
experiencing some trouble. 

mainly, I can not seem to get the connector going. I have created an helper 
to load all JS to view, and tried to load the connector in my controller.

Any suggestions? Or perhaps you have this working on your projects?

What is the best approach here? I am not to experienced with components and 
such.. 

Thanks for any help on this..

Regards!
-Tom

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




Re: gebo admin template

2012-08-10 Thread MetZ
http://whatswhat.no/development/framework/cakephp-2/451-how-to-create-admin-panel-with-own-theme-in-cakephp

Have fun :)

kl. 15:17:32 UTC+2 torsdag 9. august 2012 skrev Rahul følgende:
>
> Hi,
>
> I am looking for some help to setup gebo admin template for my project, 
> please share any useful links/info  .
>
> gebo admin template is the paid one and help is required to port that in  
> cakephp.
>
> Thanks,
>
>

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




Re: Ajax submit Data

2012-08-10 Thread MetZ
Oh sorry.. Did not see you double posted :/

What are you wondering about? just ask and I will try to help you out..

-Tom
PS! show me what you got this far.. (your code).


kl. 11:53:16 UTC+2 fredag 10. august 2012 skrev MetZ følgende:
>
> Here you are:
>
> http://whatswhat.no/development/framework/cakephp-2/468-jquery-twitter-bootstrap-typeahead-ajax-user-search-with-onselect-in-cakephp-2
>
> Modify to your needs.
>
> -Tom
>
> kl. 09:49:08 UTC+2 fredag 10. august 2012 skrev Mr. Manager følgende:
>>
>> Dear All,
>>
>> I hope that anyone can help me I am using cakephp 2.1 and I would like to 
>> sumit data for the name field of my table via ajax to controller function 
>> in order to search for the whole record.
>>
>> It better If anyone available for chatting with me because it make easier.
>>
>> This issue is in hurry to be solved.
>>
>> Sincerely,
>> Mr. Manager,
>>
>

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




Re: Ajax submit Data

2012-08-10 Thread MetZ
Here you are:
http://whatswhat.no/development/framework/cakephp-2/468-jquery-twitter-bootstrap-typeahead-ajax-user-search-with-onselect-in-cakephp-2

Modify to your needs.

-Tom

kl. 09:49:08 UTC+2 fredag 10. august 2012 skrev Mr. Manager følgende:
>
> Dear All,
>
> I hope that anyone can help me I am using cakephp 2.1 and I would like to 
> sumit data for the name field of my table via ajax to controller function 
> in order to search for the whole record.
>
> It better If anyone available for chatting with me because it make easier.
>
> This issue is in hurry to be solved.
>
> Sincerely,
> Mr. Manager,
>

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




Re: How to call css with ie6 or ie7

2012-08-09 Thread MetZ
 

kl. 14:48:37 UTC+2 tirsdag 7. august 2012 skrev suttipong Pratum følgende:
>
> How to coding css with cakePHP  
>
>  
>   
>   
>
>   
>
>
> thank you 
>
> sodaZa
>

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




Re: Cakephp 2.1 Submit Data with ajax

2012-08-09 Thread MetZ
Here is the 
solution: 
http://whatswhat.no/development/framework/cakephp-2/465-making-a-jquery-ajax-call-with-security-component-activated-in-cakephp-2


kl. 09:46:05 UTC+2 torsdag 9. august 2012 skrev Mr. Manager følgende:
>
> Dear All,
>
> I have problem with submit data using ajax because I would like user to 
> submit data of one field in my table and that value will search condition 
> from table in insert the whole record into another table.
>
> I am looking forward to hearing from you as possible.
>
> Sincerely Yours,
> Ly Dara,
>

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




cake_sessions in DB and how do I use the data?

2012-08-09 Thread MetZ
Okei,, so I am trying out the save sessions to DB and make use of them in 
my views.

My cake_sessions table are been updated just fine with my sessions data, 
but now I am wondering how to access this data.

Couple things I want to to is:

1) Display current logged in users => There are 3 logged in users => 
Perhaps list the users ul li user 1 /li li user 2 /li li user 3 /li  There are 12 visitors browsing the 
site right now.


Can I do this with the cake_sessions AS-IS or do I need to make something 
custom row/stuff to display what I need?

Thanks for all your help on this!
-Tom


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




Re: Problems with ajax and security component.

2012-08-08 Thread MetZ
I am struggling with the exact same problem..

If anyone have a suggestion???
see: 
http://stackoverflow.com/questions/11869336/cakephp-2-1-making-a-jquery-ajax-call-with-security-component-activated

-Tom


kl. 21:41:18 UTC+1 torsdag 8. desember 2011 skrev porangi.chris følgende:
>
> Hi,
>
> I'm having issues with running Ajax and the security component
> alongside each other.  Security works fine on the other forms.  Ajax
> works fine if Security is commented out.
>
> Security is included in the App Controller alongside other components
>
> 'Security' => array(
> 'csrfExpires' => '+2 hour'
> )
>
> and I've added the line into AppController:BeforeFilter.
>
> $this->Security->blackHoleCallback = '_fail';
>
> I've tried this in the beforeFilter function of the controller but not
> work:
>
> if(isset($this->Security) && $this->action == 'tracker') {
>  $this->Security->csrfCheck = false;
> }
>
> basically I have a ajax query which fails:
>
> function update_log() {
> //This is our ajax call.
> jQuery.ajax({
> type: 'POST',
> url: "/logs/
> tracker",
> data : {"lat": latitude, "lon":longitude,
> "resource":resource},
> dataType : 'json',
> success: function(data) {
> jQuery('input#logid').val(data.log);
> }
> }); //End Visitor Code
>
> I tried to construct a hidden form which I serialised and sent which
> had the tokens but this failed too.
>
> Please help - this needs to go live :(
>
> Thanks
>
> Chris
>
>

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




Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread MetZ
Hi Mark.. 

- Setting validation errors to view to display them in an element => You 
need to correct: Error message 1, Error message 2, Error message 3 => Need 
it ;)
- __('some text', true) => For translation strings, not sure why I started 
to use the TRUE, but I think it is because of not beeing able to only have 
__('some text') inside the strings (Suggestion??)

And for the validation Redundancy ? what exactly do you mean? 
I am validating in models => and pushing messages to the view (not using 
the error => true on my form fields, all are set to false and display the 
validation messages in element as explained before.

And regarding baking.. Have never used it..  =) Any good tutorials on it? I 
need to use terminal right? 

I am developing on my development VPS server, not local, but have terminal 
access.. 

Thanks for your time!
-Tom


kl. 20:05:19 UTC+2 fredag 3. august 2012 skrev euromark følgende:
>
> for starters, take out the validation redundancy
> why setting the errors to the view? also not necessary 
> also, in 2.x your __() looks differently (arguments usually are not "true" 
> but replacement strings)
>
> why dont you use baking? it would display a better output than you 
> currently have
>
>
>
> Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ:
>>
>> Yes, I understand what you are doing :) 
>> Have a couple of those myself.. 
>>
>> But my question is (perhaps not clear enough), the best practice for a 
>> function like add and edit.
>>
>> I am thinking about:
>> if ($this->request->is('post')) {
>> $this->User->set($this->request->data);
>> if ($this->User->validates()) {
>> 
>>
>> Those things inside the function. Like,, what approach/setup would you 
>> use on cake 2.x to talk with the db and make things happen :)
>>
>> I am just wondering if I am doing it 100% correct, as I can not find any 
>> good tutorials on it anywhere..
>>
>> Here is my add function as is today, any pointers?
>>
>> public function admin_add() {
>> $this->set('title_for_layout', __('Add new role',true));
>> if ($this->request->is('post')) {
>> $this->Role->set($this->request->data);
>> if ($this->Role->validates()) {
>> if ($this->Role->save($this->request->data)) {
>> $this->Session->setFlash(__('New role created.',true), 
>> 'admin/flash/success');
>> $this->redirect(array('action' => 'index'));
>> } else {
>> $this->Session->setFlash(__('Could not create role, please try 
>> again.',true), 'admin/flash/error');
>> }
>> } else {
>> // Didn't validate
>> }
>> }
>> $this->set('errors', $this->Role->validationErrors);
>> }
>>
>> -Tom
>>
>>
>>
>> kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:
>>>
>>> i use a single method, add/edit even if is user or admin, 
>>> the difference between add/edit is that on edit you have the ID set, or in 
>>> parameter or in $this->data
>>>
>>> admin_editpost($id = null){
>>>if(is_null($id){
>>>//something
>>>}
>>> }
>>>
>>> i guess you understand
>>>
>>> vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>>>>
>>>> Hi all..
>>>>
>>>> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  
>>>> and I am wondering, what are the best practices for the new framework?
>>>> AND YES, I have read the documents/book :)
>>>>
>>>> I am just wondering how you do it, so I can compare my work and see if 
>>>> I am heading in the right direction with my app.
>>>>
>>>> So if anyone could give me an idea about a couple simple add/edit 
>>>> functions, and how the best practice for this, I would appreciate it :)
>>>>
>>>> like:
>>>>
>>>> admin_users_add() {
>>>> }
>>>>
>>>> admin_users_edit() {
>>>> }
>>>>
>>>> and other regular functions you might have an example for.
>>>>
>>>> Thanks all!
>>>> Awesome!
>>>>
>>>> -Tom
>>>>
>>>

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread MetZ
Yes, I understand what you are doing :) 
Have a couple of those myself.. 

But my question is (perhaps not clear enough), the best practice for a 
function like add and edit.

I am thinking about:
if ($this->request->is('post')) {
$this->User->set($this->request->data);
if ($this->User->validates()) {


Those things inside the function. Like,, what approach/setup would you use 
on cake 2.x to talk with the db and make things happen :)

I am just wondering if I am doing it 100% correct, as I can not find any 
good tutorials on it anywhere..

Here is my add function as is today, any pointers?

public function admin_add() {
$this->set('title_for_layout', __('Add new role',true));
if ($this->request->is('post')) {
$this->Role->set($this->request->data);
if ($this->Role->validates()) {
if ($this->Role->save($this->request->data)) {
$this->Session->setFlash(__('New role created.',true), 
'admin/flash/success');
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('Could not create role, please try 
again.',true), 'admin/flash/error');
}
} else {
// Didn't validate
}
}
$this->set('errors', $this->Role->validationErrors);
}

-Tom



kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:
>
> i use a single method, add/edit even if is user or admin, 
> the difference between add/edit is that on edit you have the ID set, or in 
> parameter or in $this->data
>
> admin_editpost($id = null){
>if(is_null($id){
>//something
>}
> }
>
> i guess you understand
>
> vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:
>>
>> Hi all..
>>
>> I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  and 
>> I am wondering, what are the best practices for the new framework?
>> AND YES, I have read the documents/book :)
>>
>> I am just wondering how you do it, so I can compare my work and see if I 
>> am heading in the right direction with my app.
>>
>> So if anyone could give me an idea about a couple simple add/edit 
>> functions, and how the best practice for this, I would appreciate it :)
>>
>> like:
>>
>> admin_users_add() {
>> }
>>
>> admin_users_edit() {
>> }
>>
>> and other regular functions you might have an example for.
>>
>> Thanks all!
>> Awesome!
>>
>> -Tom
>>
>

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread MetZ
Hi all..

I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x  and I 
am wondering, what are the best practices for the new framework?
AND YES, I have read the documents/book :)

I am just wondering how you do it, so I can compare my work and see if I am 
heading in the right direction with my app.

So if anyone could give me an idea about a couple simple add/edit 
functions, and how the best practice for this, I would appreciate it :)

like:

admin_users_add() {
}

admin_users_edit() {
}

and other regular functions you might have an example for.

Thanks all!
Awesome!

-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Cake 1.3 and localization of time and date

2012-01-02 Thread MetZ
Hi all.
I am currently "struggling" with localizing my created and modified
values from db.

I am using the Time helper, and have tried to get it to output real
nice.

echo $time->niceShort($post['Post']['created']);

This gived me the Today, Yesterday, and Dec 29th 2011, 23:33

Translating of the Today and Yesterday I have done in my locale.po
file, so they are no problem, but I can not seem to get the Dec 29th
2011 to display as: 29 Des 2011 or similar.

How can I get it working? Any suggestions?
I have all, Jan -> Dec in locale.po file, but they do not translate
using time helper.

Any and all help! Much Appreciated!
Thanks!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Building a support ticket system

2011-12-13 Thread MetZ
Hi all!

I am in the process of building a simple support ticket system for my
web application, and I would like some input and/or suggestions on how
to get the functionality I am looking for.

1) Add Email adresses (example: supp...@domain.com)
2) Retrieve emails via pop3 from mailserver (I do not want to use
imap, I want to empty the mailbox)
3) Save emails to database (structure? suggestions on how to do this?)
4) Reply to sender with "you message has been received, your ticket
number is 123456"
5) Online handling of tickets items (unique url for user to be able to
modify/write more info to the ticket)
example: domain.com/support/ticket?823e9d923dm3m403dm3409fj340fr34
6) Ticket status (Waiting, Replied, Closed)

So, any suggestions, know of any plugins or something that will help
me out making this, I will as always, appreciate any input ;)

Thanks all!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-12 Thread MetZ
;)

That was what I thought about helpers yes..

Helper => will be used to generate the menu

You would suggest to pull the menu + links fra database in
app_controller beforerender, might work fine not using component for
this.

As I do not need to get the menues on every page, how would you
suggest to only use the menu database retrival when needed?

using if this params controller= controller ? or something like that?
or do you know of a better way ?

Thanks for all help and suggestions this far!

-Tom


On 12 Des, 07:17, Perry  wrote:
> helpers should not get data directly, and I remember cakephp doesn't
> suggest get data in components neither( i cant' find the refer), why not
> get menu data in AppController's beforeRender method?
>
>
>
>
>
>
>
>
>
> On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
>
> > Hi.
>
> > I am storing my menues and links(tree behavior) in database. I am
> > using several themes for the system, and hardcoding menues manuallly
> > foreach theme is not an option.
>
> > I have no problem outputting the menues and links with a component and
> > helper in my themes, but i am simply wodering about the best practice
> > to do this?
>
> > Example, get menues and links from db in component, generate menu
> > output with helper.
>
> > Or should i do all this in the helper?
>
> > Thanks!
>
> > tom
>
> > On Dec 8, 11:42 pm, Perry  wrote:
> > > why consider components and helpers?
>
> > > do you store your menu structures in database? why not just treat it as a
> > > data and output it directly in layout?
>
> > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > Hi all!
>
> > > > I am looking for a couple of suggestions.
>
> > > > I am currently working on a tree menu part of my app, where
> > > > administrators can create menues, add links to the menues and move the
> > > > links up and down in the tree.
>
> > > > Now, I am looking how to output this menu with links on the frontend.
>
> > > > Any suggestions on how I should proceed in this?
>
> > > > Currently, I am getting my menues and links in a component, I am
> > > > initializing the "getmenues" function in component from
> > > > app_controller.php.
>
> > > > And in my views, I call a helper to build the menu ul li li /ul
>
> > > > Do I need to use a component for this task? Or can I just include
> > > > everything in the helper? the database calls I mean?
>
> > > > I have noe experience with helpers and components from before, so
> > > > please be gentle with me ;)
>
> > > > Thanks for any and all help on this issue!!
>
> > > > BTW: Cake  1.3.13
>
> > > > -Tom
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > athttp://groups.google.com/group/cake-php
>
> > > --
> > > Perry | 彭琪http://pengqi.me
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Perry | 彭琪http://pengqi.me

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-11 Thread MetZ

Hi.

I am storing my menues and links(tree behavior) in database. I am
using several themes for the system, and hardcoding menues manuallly
foreach theme is not an option.

I have no problem outputting the menues and links with a component and
helper in my themes, but i am simply wodering about the best practice
to do this?

Example, get menues and links from db in component, generate menu
output with helper.

Or should i do all this in the helper?

Thanks!

tom

On Dec 8, 11:42 pm, Perry  wrote:
> why consider components and helpers?
>
> do you store your menu structures in database? why not just treat it as a
> data and output it directly in layout?
>
>
>
>
>
>
>
>
>
> On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > Hi all!
>
> > I am looking for a couple of suggestions.
>
> > I am currently working on a tree menu part of my app, where
> > administrators can create menues, add links to the menues and move the
> > links up and down in the tree.
>
> > Now, I am looking how to output this menu with links on the frontend.
>
> > Any suggestions on how I should proceed in this?
>
> > Currently, I am getting my menues and links in a component, I am
> > initializing the "getmenues" function in component from
> > app_controller.php.
>
> > And in my views, I call a helper to build the menu ul li li /ul
>
> > Do I need to use a component for this task? Or can I just include
> > everything in the helper? the database calls I mean?
>
> > I have noe experience with helpers and components from before, so
> > please be gentle with me ;)
>
> > Thanks for any and all help on this issue!!
>
> > BTW: Cake  1.3.13
>
> > -Tom
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Perry | 彭琪http://pengqi.me

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best practice output a Dynamic menu

2011-12-08 Thread MetZ
Hi all!

I am looking for a couple of suggestions.

I am currently working on a tree menu part of my app, where
administrators can create menues, add links to the menues and move the
links up and down in the tree.

Now, I am looking how to output this menu with links on the frontend.

Any suggestions on how I should proceed in this?

Currently, I am getting my menues and links in a component, I am
initializing the "getmenues" function in component from
app_controller.php.

And in my views, I call a helper to build the menu ul li li /ul

Do I need to use a component for this task? Or can I just include
everything in the helper? the database calls I mean?

I have noe experience with helpers and components from before, so
please be gentle with me ;)

Thanks for any and all help on this issue!!

BTW: Cake  1.3.13

-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Send Email problem with multiple receivers

2011-12-02 Thread MetZ
Hi again all!

I have still not found a solution to this problem!
Cake 1.3.13, unable to send email to multiple recipients.

Please help me!

Any suggestions on how I can debug this problem? I get no info
whatsoever in any logs, have debugging to 2 in core.

Thank you for all your help!

-Tom

On 1 Des, 17:49, MetZ  wrote:
> ooh.. sorry... Cake 1.3.13 ;)
>
> Thanks for your time this far!
>
> -Tom
>
> On 1 Des, 10:19, euromark  wrote:
>
>
>
>
>
>
>
> > if you are using the new EmailLib in 2.0 you should be using the
> > setter methods:
> > $this->Email->to()
> > etc
>
> > On 1 Dez., 06:36, Graham Weldon  wrote:
>
> > > What CakePHP version are you on?
>
> > > Cheers,
> > > Graham Weldonhttp://grahamweldon.com
> > > e. gra...@grahamweldon.com
> > > p. (+61) 0407 017 293
> > > Skype: grahamweldon
>
> > > On Thursday, 1 December 2011 at 4:20 PM, MetZ wrote:
> > > > Hi..
> > > > Tried it, did not work either, only the first email in array get the
> > > > email.
>
> > > > Any other suggestions??
>
> > > > -Tom
>
> > > > On 1 Des, 06:03, Graham Weldon  > > > (http://gmail.com)> wrote:
> > > > > Have you tried an array of email address?
>
> > > > > $this->Email->to = array('du...@rmail.com (http://rmail.com)', 
> > > > > 'du...@email.com (http://email.com)');
>
> > > > > Cheers,
> > > > > Graham Weldonhttp://grahamweldon.com
> > > > > e. gra...@grahamweldon.com (http://grahamweldon.com)
> > > > > p. (+61) 0407 017 293
> > > > > Skype: grahamweldon
>
> > > > > On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
> > > > > > Hi all!
>
> > > > > > I am having a problem, when sending email with multiple reveivers in
> > > > > > $this->Email->to
>
> > > > > > It will only send to one adress (the first one =>
> > > > > > email_numb...@gmail.com (mailto:email_numb...@gmail.com 
> > > > > > (http://gmail.com))), why is that? any suggestions!?!
>
> > > > > > $this->Email->to = 'email_numb...@gmail.com 
> > > > > > (mailto:email_numb...@gmail.com), email_numb...@gmail.com 
> > > > > > (mailto:email_numb...@gmail.com (http://gmail.com))';
> > > > > > $this->Email->subject = 'Ma Subject!';
> > > > > > $this->Email->from = Configure::read('App.noreply');
> > > > > > $this->Email->template = 'new_notify';
> > > > > > $this->Email->sendAs = 'both';
> > > > > > $this->Email->send();
> > > > > > $this->Email->reset();
>
> > > > > > --
> > > > > > Our newest site for the community: CakePHP Video 
> > > > > > Tutorialshttp://tv.cakephp.org
> > > > > > Check out the new CakePHP Questions 
> > > > > > sitehttp://ask.cakephp.organdhelpotherswith their CakePHP related 
> > > > > > questions.
>
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com 
> > > > > > (mailto:cake-php+unsubscr...@googlegroups.com) For more options, 
> > > > > > visit this group athttp://groups.google.com/group/cake-php
>
> > > > --
> > > > Our newest site for the community: CakePHP Video 
> > > > Tutorialshttp://tv.cakephp.org
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
> > > > questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Send Email problem with multiple receivers

2011-12-01 Thread MetZ
ooh.. sorry... Cake 1.3.13 ;)

Thanks for your time this far!

-Tom


On 1 Des, 10:19, euromark  wrote:
> if you are using the new EmailLib in 2.0 you should be using the
> setter methods:
> $this->Email->to()
> etc
>
> On 1 Dez., 06:36, Graham Weldon  wrote:
>
>
>
>
>
>
>
> > What CakePHP version are you on?
>
> > Cheers,
> > Graham Weldonhttp://grahamweldon.com
> > e. gra...@grahamweldon.com
> > p. (+61) 0407 017 293
> > Skype: grahamweldon
>
> > On Thursday, 1 December 2011 at 4:20 PM, MetZ wrote:
> > > Hi..
> > > Tried it, did not work either, only the first email in array get the
> > > email.
>
> > > Any other suggestions??
>
> > > -Tom
>
> > > On 1 Des, 06:03, Graham Weldon http://gmail.com)> 
> > > wrote:
> > > > Have you tried an array of email address?
>
> > > > $this->Email->to = array('du...@rmail.com (http://rmail.com)', 
> > > > 'du...@email.com (http://email.com)');
>
> > > > Cheers,
> > > > Graham Weldonhttp://grahamweldon.com
> > > > e. gra...@grahamweldon.com (http://grahamweldon.com)
> > > > p. (+61) 0407 017 293
> > > > Skype: grahamweldon
>
> > > > On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
> > > > > Hi all!
>
> > > > > I am having a problem, when sending email with multiple reveivers in
> > > > > $this->Email->to
>
> > > > > It will only send to one adress (the first one =>
> > > > > email_numb...@gmail.com (mailto:email_numb...@gmail.com 
> > > > > (http://gmail.com))), why is that? any suggestions!?!
>
> > > > > $this->Email->to = 'email_numb...@gmail.com 
> > > > > (mailto:email_numb...@gmail.com), email_numb...@gmail.com 
> > > > > (mailto:email_numb...@gmail.com (http://gmail.com))';
> > > > > $this->Email->subject = 'Ma Subject!';
> > > > > $this->Email->from = Configure::read('App.noreply');
> > > > > $this->Email->template = 'new_notify';
> > > > > $this->Email->sendAs = 'both';
> > > > > $this->Email->send();
> > > > > $this->Email->reset();
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video 
> > > > > Tutorialshttp://tv.cakephp.org
> > > > > Check out the new CakePHP Questions 
> > > > > sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
> > > > > questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com 
> > > > > (mailto:cake-php+unsubscr...@googlegroups.com) For more options, 
> > > > > visit this group athttp://groups.google.com/group/cake-php
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Send Email problem with multiple receivers

2011-11-30 Thread MetZ
Hi..
Tried it, did not work either, only the first email in array get the
email.

Any other suggestions??

-Tom

On 1 Des, 06:03, Graham Weldon  wrote:
> Have you tried an array of email address?
>
> $this->Email->to = array('du...@rmail.com', 'du...@email.com');
>
> Cheers,
> Graham Weldonhttp://grahamweldon.com
> e. gra...@grahamweldon.com
> p. (+61) 0407 017 293
> Skype: grahamweldon
>
>
>
>
>
>
>
> On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
> > Hi all!
>
> > I am having a problem, when sending email with multiple reveivers in
> > $this->Email->to
>
> > It will only send to one adress (the first one =>
> > email_numb...@gmail.com (mailto:email_numb...@gmail.com)), why is that? any 
> > suggestions!?!
>
> > $this->Email->to = 'email_numb...@gmail.com 
> > (mailto:email_numb...@gmail.com), email_numb...@gmail.com 
> > (mailto:email_numb...@gmail.com)';
> > $this->Email->subject = 'Ma Subject!';
> > $this->Email->from = Configure::read('App.noreply');
> > $this->Email->template = 'new_notify';
> > $this->Email->sendAs = 'both';
> > $this->Email->send();
> > $this->Email->reset();
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Send Email problem with multiple receivers

2011-11-30 Thread MetZ
Hi all!

I am having a problem, when sending email with multiple reveivers in
$this->Email->to

It will only send to one adress (the first one =>
email_numb...@gmail.com), why is that? any suggestions!?!

$this->Email->to = 'email_numb...@gmail.com, email_numb...@gmail.com';
$this->Email->subject = 'Ma Subject!';
$this->Email->from = Configure::read('App.noreply');
$this->Email->template = 'new_notify';
$this->Email->sendAs = 'both';
$this->Email->send();
$this->Email->reset();

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best approach to use GAPI class

2011-11-03 Thread MetZ
Hi.

I am looking to have a google analytics display in my admin panel..

So I was thinking; http://code.google.com/p/gapi-google-analytics-php-interface/

Now, since I have never added other classes to cake, I am wondering
how I should approach this, and how to use the gapi_class in my
controller(s).

1) Where to put it
2) how to load it in controller(s)
3) any example how you would use it? Or if you are using it, let me
know best approach!

Any and all help is, as always, greatly appreciated!!

Thanks!!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Looking to hire cake, ajax, jquery expert

2011-10-31 Thread MetZ
Hi.

First off, I am really sorry if this is the wrong place to post such a
request, but I could not find anywhere else!?!

I am looking to hire a cake developer that have excellent ajax +
jquery skills.

This is for a project I am working on, and I am looking to have a
FILTER content function that uses ajax, jquery on frontend.

I am a complete noob regarding ajax and jquery, so instead of using
alot of time to figure this out myself, I was wondering if there are
any skilled developers that would like some fast money to their paypal
or whatever? =)

Here are some details about my setup:
Cake 1.3.12

- Categories (nested)
- Tags
- Content

Navigation will be like this:
- Filter on content type (type1, type2)
- Filter content on what Tag assigned
- Filter content on what sub-sub category assigned

Looking for a similar filter function that example templatemonster are
using to filter templates.

All controllers, models/db rows and what not are present, only the
views/elements/js and functions to do this filtering on my frontend is
remaining.

Interested? Drop me an email @ metz80 at gmail-com

Thanks!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Please give me some suggestions on this

2011-10-29 Thread MetZ
Hi all..

I am looking to implement a wysiwyg editor with a media library plugin
of some kind.. Have been looking at Tinymce and elfinder for library,
but I am not sure if I should go this way, or if there are any other
solutions that meets my requirements.

Requirements:
- Simple wysiwyg (only simple regular text buttons bold, italic, left
align and so on)
- possible to tie in a media/file plugin button for images and other
files
- access to whole media library trough GUI

I am currently using markitup, and for me, it is perfect, but for
other admins/moderators that do not know any html, it is not good.

Do any of you have experince with a similar setup for cake
application?
Please share your knowledge on how to proceed..

Thanks all!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Returning new value from private function

2011-10-27 Thread MetZ
Hi all..

I am not sure if I am doing this correct, but I am trying to return a
private function from my app_controller.php to posts_controller.php

App_controller.php

function __utfConvertChar($tempurl) {
$j = mb_strlen($tempurl);
for ($k = 0; $k < mb_strlen($tempurl); $k++) {
$char = mb_substr($tempurl, $k, 1);
if($this->__utfCharToNumber($char) == '195184' 
|| $this-
>__utfCharToNumber($char) == '195152')
{
$newurl = str_replace($char,'o',$tempurl);
}
if($this->__utfCharToNumber($char) == '195165' 
|| $this-
>__utfCharToNumber($char) == '195133' || $this-
>__utfCharToNumber($char) == '195164' || $this-
>__utfCharToNumber($char) == '195132')
{
$newurl = str_replace($char,'aa',$tempurl);
}
if($this->__utfCharToNumber($char) == '195188' 
|| $this-
>__utfCharToNumber($char) == '195156')
{
$newurl = str_replace($char,'u',$tempurl);
}
}
return $newurl;
}
function __utfCharToNumber($char) {
$i = 0;
$number = '';
while (isset($char{$i})) {
$number.= ord($char{$i});
++$i;
}
return $number;
}

Post_controller.php
$this->__utfConvertChar($tempurl);


Am I doing something wrong here? I can not see what.. Please assist
me, and/or let me know that this is not the best practice to do this.

Thanks all for any help
Regards!
-Tom


I am unable to retrieve the $newurl to my posts_controller.php

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form dropdown multiple selected array not working

2011-10-24 Thread MetZ
Hi all..

I just wanted to let anyone else with similar problem know how I
solved this.

in view!
 data['Content']['category_id'] != '')
{
$cont_cats = explode(",",$this->data['Content']['category_id']);
}else{
$cont_cats = '';
}
echo $form-
>input('category_id',array('size'=>'10','div'=>false,'label'=>false,'type'
=> 'select', 'multiple' => true,'options' =>
array($categories),'selected' =>$cont_cats));
 ?>

Now it is working as it should =)

Have fun, and thanks for all help!
-Tom



On 13 Okt, 12:46, WebbedIT  wrote:
> If this is a HABTM relationship, which it would have to be to allow
> many contents to be related to many categories, then you have your
> field named wrong.
>
> You essentially have a belongsTo field there where one row can only
> have one relation to Category via Content.category_id, what you need
> is a field like:
> $this->Form->input('categories', array('type'=>'select',
> 'multiple'=>'checkbox', 'options'=>$categories));
>
> This will give you a data[Category][Category] type array.
>
> Book entry:http://book.cakephp.org/view/1034/Saving-Related-Model-Data-HABTM
>
> HTH, Paul.
>
> On Oct 12, 6:16 pm, MetZ  wrote:
>
>
>
>
>
>
>
> > It is not to display all categories (options), it is on EDIT, to set
> > SELECTED on a category option that are selected.
>
> > Example: admin_edit.ctp view
> > echo 
> > $form->input('Content.category_id',array('selected'=>$this->data['Content']
>
> > ['category_id'],'size'=>'10','div'=>false,'label'=>false,'type'
> > =>'select', 'multiple' => true,'options' => array($categories)));
>
> > The array of the SELECTED categories does not work, have tried many
> > different versions of find in the controller to list the selected
> > categories.
> > $this->data['Content']['category_id'] = 1,3,7
>
> > Output:
> >   > id="ContentCategoryId_" type="hidden">
> >  > multiple="multiple" id="ContentCategoryId">
> > Test Cat1
>
> > .. Test Cat 2
> > Test3
> > 
>
> > I can NOT get the SELECTED inserted to other options than the first
> > one in the array. I have no idea why this is happening
> > If I echo $this->data['Content']['category_id']
> > it output: 1,3,7 so the array contains the ids that where selected
> > when the content was created.
>
> > Any and all help on this will be appreciated!!
> > Thanks all.
>
> > -Tom
>
> > On 11 Okt, 13:36, euromark  wrote:
>
> > > why not
> > > 'options' => $categories
> > > ?
>
> > > since $categories probably is an array and contains the keys
>
> > > On 10 Okt., 21:38, MetZ  wrote:
>
> > > > Hi all.
>
> > > > I am having trouble setting the selected to the options when selected
> > > > is an array.
>
> > > > (This is a edit content view)
> > > > Dropdown display all categories (using generatetreelist to list my
> > > > categories)
>
> > > > echo 
> > > > $form->input('Content.category_id',array('selected'=>array($this->data['Con
> > > >  tent']
>
> > > > ['category_id']),'size'=>'10','div'=>false,'label'=>false,'type' =>
> > > > 'select', 'multiple' => true,'options' => array($categories)));
>
> > > > My array:  $this->data['Content']['category_id'] = '4,5,6,7'
>
> > > > Only the number 4 category option get "selected" in the dropdown.
>
> > > > Anyone know if this is a bug or am I missing something here? I can not
> > > > see it, please help ;)
>
> > > > Thanks all!!
> > > > -Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Retrieve extra field with generatetreelist

2011-10-23 Thread MetZ
Hi...

Sooo.. no suggestions?

$categories = $this->Category->generatetreelist(null, null, null, '|--
', $recursive = -1 );

Looking to retrieve the extra field "Category.published" and display
it in my html table.

Should I use another find and merge them or something?

Using this in view:










$value):
$class = null;
if ($i++ % 2 == 0) {
$class = 'odd';
}
$edit = $html->link($html->image("icons/16_icon_edit.png"),
array('action' => 'edit', $key), array('title'=>'Endre','escape' =>
false));
$delete = $html->link($html->image("icons/
16_icon_delete.png"), array('action' => 'delete', $key),
array('valign'=>'center','class'=>'delete_trigger','rel'=>'#error','title'=>'Slett','escape'
=> false));
?>




N/A
  
   





On 19 Okt, 18:48, MetZ  wrote:
> Hi all.
> I am wondering how I can retrieve an extra field from my rows using
> generatetreelist?
> $this->data = $this->Category->generatetreelist(null, null, null,
> '   ');
>
> The field I am looking for is "status", to display if the category is
> active or not.
>
> And,, btw.. I am using generatetreelist to list all nested categories
> in a html table with children.
> If u know of a better way to get all categories, and to put everything
> in an array to output in a html table, please let me know ;)
>
> Thanks for all and any help!
> Regards!
> -Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Retrieve extra field with generatetreelist

2011-10-19 Thread MetZ
Hi all.
I am wondering how I can retrieve an extra field from my rows using
generatetreelist?
$this->data = $this->Category->generatetreelist(null, null, null,
'   ');

The field I am looking for is "status", to display if the category is
active or not.

And,, btw.. I am using generatetreelist to list all nested categories
in a html table with children.
If u know of a better way to get all categories, and to put everything
in an array to output in a html table, please let me know ;)


Thanks for all and any help!
Regards!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Limit output from DB based on user_id

2011-10-18 Thread MetZ

Hi and thanks for replies

Ok, that was what I was thinking. Now, perhaps you could give me a
hand on the best practice on a more advanced ownership of rows!?!

I am looking to "lock" down the db queries as much as possible, only
displaying the results that belongs to a user.

My app is built like this:

DB:
 - team
id, name, user_id (what user it belongs to)

- user
 id, name++, team_id (what team the user owns)

models are associated with each other.

routes:
domain.com
team1.domain.com
team2.domain.com
domain.com/admin & team*.domain.com/admin

Controllers:
teams_controller
users_controller


Now, I will try to explain:
- When a visistor visit domain.com, there is a "regular" website, with
some blablabla, and a list of teams.
- Visitor visit team1.domain.com, there is a website for the team1
(using their selected theme and so on)
- Visitor visit */admin, there is a admin area for team-owners (select
theme, write their content and so on)

Perhaps you could suggest any approach/best practice to "lock" down
the db access on these areas?
Example, when visitor visits team*.domain.com, every single db request
should be using the teamID (there are more tables/rows that have
team_id)
What is the best approach to get this id from db? ID WHERE teamname ==
team1 ? bootstrap? Routes?
And where to save it to use in every other find request in controllers
- Was thinking sessions? and destroy the session, and create a new one
if user visits another team or the mainpage ?

What do you think?

Same goes for admin, the best place to save the teamID, to use in all
controllers (write to config? Session?)


I am not sure how to proceed to really lock it down, so that teamID
only values are pulled from DB, and to completely remove the chance
that other team owners/visitors get access to other team information
without visiting their website/admin panel login.

Yet again!
Thanks for any and all help on this ;)

Kind regards!
-Tom



-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Limit output from DB based on user_id

2011-10-17 Thread MetZ
Hi.

I am wondering how I can go about to limit/lock the db requests to
ONLY allow db rows that have the user_id = session user_id ?

Example: if a table row has another user_id than Session logged in id,
then the controller will not touch this row at all.

I have several controllers that I want to lock-down this way to make
sure that no users get access to other users db values/contents.

Any suggestions on how I go about doing this??

Thanks all for your time! You are indeed awesome ;)

-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


element vs controller vs component vs helper Best Practice suggestions

2011-10-14 Thread MetZ
Hi all.

I am not sure how to proceed. I want to display google analytics chart
in my dashboard.

I have in my user_controller.php admin_dashboard function:
all google analytics blablabla
to retrieve the data for the view trough GA api.
I am calling a config file (uname + pass), and a model + datasources
file in this ga function.

In my view I output it just fine, as is, but slow :(

Now, my question is, to speed this process up when visiting dashboard
(today, it takes time to load, because the controller retrieves all
the data for the GA output to view before displaying the dashboard).

I was thinking of:
- Make a separate function (admin_ga)
- make element and requestaction that function
- cache the element/requestaction

- ajax call some view/element to speed things up?

Or something like that.

I am not sure what would be the best practice/approach on this!

Any suggestions??

Thanks for all input on this... Awesome ;)

-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form dropdown multiple selected array not working

2011-10-12 Thread MetZ
It is not to display all categories (options), it is on EDIT, to set
SELECTED on a category option that are selected.

Example: admin_edit.ctp view
echo $form->input('Content.category_id',array('selected'=>$this-
>data['Content']
['category_id'],'size'=>'10','div'=>false,'label'=>false,'type'
=>'select', 'multiple' => true,'options' => array($categories)));

The array of the SELECTED categories does not work, have tried many
different versions of find in the controller to list the selected
categories.
$this->data['Content']['category_id'] = 1,3,7

Output:
 

Test Cat1

.. Test Cat 2
Test3


I can NOT get the SELECTED inserted to other options than the first
one in the array. I have no idea why this is happening
If I echo $this->data['Content']['category_id']
it output: 1,3,7 so the array contains the ids that where selected
when the content was created.

Any and all help on this will be appreciated!!
Thanks all.

-Tom


On 11 Okt, 13:36, euromark  wrote:
> why not
> 'options' => $categories
> ?
>
> since $categories probably is an array and contains the keys
>
> On 10 Okt., 21:38, MetZ  wrote:
>
>
>
>
>
>
>
> > Hi all.
>
> > I am having trouble setting the selected to the options when selected
> > is an array.
>
> > (This is a edit content view)
> > Dropdown display all categories (using generatetreelist to list my
> > categories)
>
> > echo 
> > $form->input('Content.category_id',array('selected'=>array($this->data['Content']
>
> > ['category_id']),'size'=>'10','div'=>false,'label'=>false,'type' =>
> > 'select', 'multiple' => true,'options' => array($categories)));
>
> > My array:  $this->data['Content']['category_id'] = '4,5,6,7'
>
> > Only the number 4 category option get "selected" in the dropdown.
>
> > Anyone know if this is a bug or am I missing something here? I can not
> > see it, please help ;)
>
> > Thanks all!!
> > -Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Form dropdown multiple selected array not working

2011-10-11 Thread MetZ
Hi all.

I am having trouble setting the selected to the options when selected
is an array.

(This is a edit content view)
Dropdown display all categories (using generatetreelist to list my
categories)

echo $form->input('Content.category_id',array('selected'=>array($this-
>data['Content']
['category_id']),'size'=>'10','div'=>false,'label'=>false,'type' =>
'select', 'multiple' => true,'options' => array($categories)));

My array:  $this->data['Content']['category_id'] = '4,5,6,7'

Only the number 4 category option get "selected" in the dropdown.

Anyone know if this is a bug or am I missing something here? I can not
see it, please help ;)

Thanks all!!
-Tom

-- 
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 unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php