Thursday, March 31, 2011

Re: How to know if a user has left a particular page

"The exact handling of the unload event has varied from version to
version of browsers. For example, some versions of Firefox trigger the
event when a link is followed, but not when the window is closed. In
practical usage, behavior should be tested on all supported browsers,
and contrasted with the proprietary beforeunload event."
source: http://api.jquery.com/unload/

so it seems this is not an exact science


On 31 Mrz., 23:12, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> or unload event...
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/3/31 euromark <dereurom...@googlemail.com>
>
>
>
>
>
>
>
> > the only way i know is that you use ajax and repeatedly make an ajax
> > call as long as he is on the site
> > as soon as there is no call anymore (for more than x seconds) you know
> > that he either closed the browser, surfed to another page or simply
> > lost the connection :)
>
> > On 31 Mrz., 23:01, Shashank <cooldude17202...@gmail.com> wrote:
> > > Hi Guys,
> > > I want to know is there any way of knowing if a user has left a
> > > particular page.
>
> > > What i mean is, suppose a user is on a page game/start, and he just
> > > closes his browser without logging out of the game than how do i get
> > > to know if he left the game or not??
>
> > > Thanks in advance!!!
>
> > --
> > 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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Cake Paginator Displaying Wrong page number

Hi all,

I am having an issue with the cake paginator. When a user comes to my
site and does a search I am using the paginator for the search
results. My code looks like this:

function search() {

$term= '';
if(!empty($this->data)) {
$term = $this->data['Search']['search_input'];
}

//$this->Product->recursive = 0;
$search = array('Product.name LIKE'=>"%$term%",
'Product.description LIKE'=>"%$term%",'Provider.name LIKE'=>"%$term%",
'Provider.description LIKE'=>"%$term%");
$this->paginate = array('conditions'=>array('provider_id !
='=>0, 'Product.published'=>true, 'Product.disabled'=>null,
'Provider.published'=>true, 'Provider.active'=>true,
'Provider.suspend'=>false, 'OR'=>$search), 'limit'=>25);
$products = $this->paginate('Product');
$title_for_layout = 'Search Results';
$this->set(compact('products', 'title_for_layout'));

}

This method does return values, and the paginator does it's job.
However, when the view displays the paginated results for the first
time it says something like "Displaying page 1 of 7". When I click on
page 2, the counter jumps to saying "Displaying page 1 of 10". My
View code for the counter is below:

<p style="float:right;">
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current%
records out of %count% total, starting on record %start%, ending on
%end%', true)
));
?>
</p>
<div class="paging" style="float:right;">
<?php echo $this->Paginator->first('<< '.__('first',
true), array(), null, array('class'=>'disabled')); ?>
<?php echo $this->Paginator->prev('< ' . __('previous',
true), array(), null, array('class'=>'disabled'));?>|
<?php echo $this->Paginator->numbers();?>|
<?php echo $this->Paginator->next(__('next', true) . ' >',
array(), null, array('class' => 'disabled'));?>
<?php echo $this->Paginator->last(__('last', true).' >>',
array(), null, array('class'=>'disabled')); ?>
</div>


I am using the paginator in other places of my site and I have not had
this issue. Only with this specific view.

Anyone else ever run into this?

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

Re: How to know if a user has left a particular page

or unload event...
--
Lep pozdrav, Tilen Majerle



2011/3/31 euromark <dereuromark@googlemail.com>
the only way i know is that you use ajax and repeatedly make an ajax
call as long as he is on the site
as soon as there is no call anymore (for more than x seconds) you know
that he either closed the browser, surfed to another page or simply
lost the connection :)

On 31 Mrz., 23:01, Shashank <cooldude17202...@gmail.com> wrote:
> Hi Guys,
> I want to know is there any way of knowing if a user has left a
> particular page.
>
> What i mean is, suppose a user is on a page game/start, and he just
> closes his browser without logging out of the game than how do i get
> to know if he left the game or not??
>
> Thanks in advance!!!

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

Re: execute query twice in a short time is a problem?

Model::create() takes an array as the first parameter.
http://api.cakephp.org/class/model#method-Modelcreate
http://book.cakephp.org/view/1031/Saving-Your-Data

On Thu, Mar 31, 2011 at 3:52 PM, cake-learner <sh.koizumi@gmail.com> wrote:
> I have a problem saving model in a loop. I am not sure the problem is
> executing
> a query twice in such a short time or how I am calling is the problem.
> I tried with $this -> controller -> Notification -> save but didn't
> work so i am trying to do with
> maunally query instead but still get the same result. only the first
> get saved but not the second one.
>
>
> foreach( $arrEmp as $employeeObj ){
> $options = array( "survey_name" => $surveyObj[ 0 ][ 'Survey' ]
> [ 'survey_name' ] );
> $this -> Notification -> create( 'Report card is realeased','',
> $currentUser[ 'Account' ][ 'id' ], $employeeObj[ 'e' ]
> [ 'accounts_id' ], 7, "HR Department", $options );
> }
>
> /**
> * create function in Notification Component
> */
> function create( $subject, $message="", $creator, $recepient, $type =
> 0, $from, $options=null ){
> $this -> controller -> loadModel('Notification');
> $this -> controller ->  Notification -> create();
> $notification[ 'subject' ] = htmlentities( $subject );
> $notification[ 'message' ] = htmlentities( $message ) .
> $defaultMessage;
> $notification[ 'from' ] = htmlentities( $from );
> $notification[ 'creator' ] = $creator;
> $notification[ 'sentto' ] = $recepient;
> $notification[ 'type' ] = $type;
>
> foreach( $notification as $key => $value ){
>  $arrKey[] = $key;
>  $arrValues[] = $value;
> }
>
> $sql .= "INSERT INTO notifications (" . implode( ",", $arrKey ) . ")
> values (" . implode( "," , $arrValues ) . " )";
> $this -> controller ->  Notification -> Query( $sql );
> }
>
> --
> 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+unsubscribe@googlegroups.com For more options, visit this group at http://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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: How to know if a user has left a particular page

the only way i know is that you use ajax and repeatedly make an ajax
call as long as he is on the site
as soon as there is no call anymore (for more than x seconds) you know
that he either closed the browser, surfed to another page or simply
lost the connection :)

On 31 Mrz., 23:01, Shashank <cooldude17202...@gmail.com> wrote:
> Hi Guys,
> I want to know is there any way of knowing if a user has left a
> particular page.
>
> What i mean is, suppose a user is on a page game/start, and he just
> closes his browser without logging out of the game than how do i get
> to know if he left the game or not??
>
> Thanks in advance!!!

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

How to know if a user has left a particular page

Hi Guys,
I want to know is there any way of knowing if a user has left a
particular page.

What i mean is, suppose a user is on a page game/start, and he just
closes his browser without logging out of the game than how do i get
to know if he left the game or not??

Thanks in advance!!!

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

Re: form, url, and id

On Thu, Mar 31, 2011 at 4:34 PM, Krissy Masters
<naked.cake.baker@gmail.com> wrote:
> What about 'action' => $this->here if it's the same url?

Not action, url:

'url' => $this->here

Same as using params['url']['url']. I don't know why I didn't think of this.

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