Re: [fw-general] Question about zend pagination

2008-11-18 Thread Daniel Tangermann

In your link to the next or whatever resultpage site:

Are you sure that param page is there?

Try something like
Zend_Debug::dump($this->_request->getParams())

You should see page = something

In my paginator template I link to
/baseUrl/module/controller/page/2

/baseUrl/module/controller/2 would not work.

Another way to debug or to find the failure is to set:

$paginator->setCurrentPageNumber(2); 


Do you see the expected results from page 2?
If so, than you definitly do not pass param page with value 2.


vladimirn schrieb:

Thank you Daniel,
This is my view script:
paginator)): ?>

paginator as $banner): ?>
 
 "





On the page i am getting expected amount of results.

Then in my controller:
$db = Zend_Registry::get ( 'db' );
$select = $db->select ()
->from ( 'banners', array ('bannerurl', 
'height', 'width', 'bannersize'
) )
->where ( 'active = ?', 'y' )
->where ('programid = ?', $programid)
->where('websiteid = ?', $websiteid)
->where('bannertype = ?', $bannertype)

->order ( 'height', 'ASC' );
$paginator = Zend_Paginator::factory($select);

// Set parameters for paginator
$paginator->setCurrentPageNumber($this->_getParam("page")); 
$paginator->setItemCountPerPage(3);

$paginator->setPageRange(5);
$this->view->paginator = $paginator;

And i am getting this on the page:
 < Previous |  1 | 2 |  Next > 
( there are 3 pictures, as expected)


And finnaly there is a links produced:

 
 
  < Previous | 
 



 
  1 | 
   
   /display/2/CL/3 2  | 
  
 
 
   /display/2/CL/3 Next > 
 



Above code for links i am getting via paginator.phtml 
It looks like:
pageCount): ?> 

 
previous)): ?> 
   " $this->previous)); ?>">< Previous  | 
 
  < Previous | 
 



pagesInRange as $page): ?> 
  current): ?>
 " $page)); ?>">  | 
  
 | 
  



 
next)): ?> 
   " $this->next)); ?>">Next > 
 
  Next >
 
 
 



So, finnal thouth :)
I am getting number of results as expectede, and i am getting pagination
div, as expected, but when i click on Next, or on 2(which is a link) i am
not navigated to the next page, same page just reload, and shows same
pictures. Also, links( 1,2,Next,Previous) dont change as visited or
something if you know what i mean.

Thanks a lot,
V


  




Re: [fw-general] Question about zend pagination

2008-11-18 Thread Daniel Tangermann
I would love to, but you have to be a little more specific what is not 
working?


Do you get an expected result without $paginator?
Dou you see the expected amount of results on page 1?
How does your link look like for the next page?

The more information you provide, the better one can help you

vladimirn schrieb:

Can anyone help on this please? :)
  




Re: [fw-general] Question about zend pagination

2008-11-17 Thread Daniel Tangermann

Can you provide a link?

I am not using Zend_View but a smarty solution.
When you dump $paginator, do you have the correct results? So only the 
necessary amount of rows?

Are you sure $page is filled?

Kinda like:
  $page = 1;
   if($this->_getParam('page ')){
   $page = $this->_getParam('page ');
   }

I am using it with success:

$this->view->pages = $paginator->getPages(); (for the paginator.tpl, 
like $this->pages->pageCount ->pagesInRange


and
$this->view->results = $paginator  (for looping the results)


My paginator.tpl looks like this, maybe it can help (remember this is 
smarty):


{if $this->pages->pageCount > 1}

{assign var=url value=$url|rtrim:"/"}

{assign var=first value=$this->pages->first}
{assign var=last value=$this->pages->last}
{if !$this->pages->pagesInRange[$first]}
href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->first}"  
><<

{/if}

{if $this->pages->pageCount > 6}
   
   {if $this->pages->previous }
   href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->previous}"  
>< Zurück |

   {/if}
{/if}

{foreach from=$this->pages->pagesInRange key=myId item=i}
 {if $i != $this->pages->current }
 {assign var=j value=/seite/$i}
   {$i}
 {else}
   {$i}
 {/if}
 {if $this->pages->last != $i} | {/if}
{/foreach}

{if $this->pages->pageCount > 6}
   
   {if $this->pages->next}
   href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->next}"  
>Weiter >

   {/if}
{/if}

{if !$this->pages->pagesInRange[$last]}
   href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->last}"  
>>>

{/if}


{/if}

vladimirn schrieb:

Thank you for swift replay :)

Now i went with this:
$page = $this->_request->getParam('page') ;
$db = Zend_Registry::get ( 'db' );
$select = $db->select ()
->from ( 'banners', array ('bannerurl', 
'height', 'width', 'bannersize'
) )
->where ( 'active = ?', 'y' )
->where ('programid = ?', $programid)
->where('websiteid = ?', $websiteid)
->where('bannertype = ?', $bannertype)

->order ( 'height', 'ASC' );
		 
$paginator = Zend_Paginator::factory($select);

   $paginator->setItemCountPerPage(3);
   $paginator->setCurrentPageNumber($page);
   $paginator->setPageRange(3);
   $paginator->setDefaultScrollingStyle('Sliding');

  
Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml');
   $this->view->paginator = $paginator; 


Still cant get proper results. Links are clickable, but not lead to next
page.
In display.phtml i have:
paginator ?>
paginator as $banner ) :?>

 "



Any suggestion?
Thanks
V
  




Re: [fw-general] Question about zend pagination

2008-11-17 Thread Daniel Tangermann

$paginator = Zend_Paginator::factory($select);

$select has to be an instance of Zend_Db_Select

Build your query with Zend_Db_Select and it shoud work

   $select = $this->db->select()
   ->from(array('a' => 'banners '), array('*'))
   ->where('active = ?', 'y')
   ->where('programid = ?', $programid)
   ->where('websiteid = ?', $websiteid)
   ->where('bannertype = ?', $bannertype )

 
;


If i am doing this:
$sql = "select * from banners where active='y' and programid='" . 
$programid . "' and websiteid = '" . $websiteid . "' and bannertype= '" 
. $bannertype . "'";  //$result = $db->fetchAll ( $sql );

  $paginator = Zend_Paginator::factory($sql);
i am getting an error:

Vladimir Nikolic schrieb:

Daniel Tangermann wrote:
Try not to pass the total $result array. Let paginator execute the 
query.


   $paginator = Zend_Paginator::factory($select);
   $paginator->setItemCountPerPage(10);
   $paginator->setCurrentPageNumber($page);
   $paginator->setPageRange(10);
   $paginator->setDefaultScrollingStyle('Sliding');

   
Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); 


   $this->view->pages = $paginator->getPages();

This case you only query for the element needing (limit,offset).

When linking make certain that you catch the selected like
$page = $this->_request->getParam('page')

Works fine for me

vladimirn schrieb:

I have a problem with zend pagination.
In my controller i have this:
$result = $db->fetchAll ( $sql );
$page = $this->_getParam ( 'page', 1 );
$paginator = Zend_Paginator::factory ( $result );
$paginator->setItemCountPerPage ( 2 );
$paginator->setCurrentPageNumber ( $page );
$paginator->setPageRange ( 5 );
Zend_View_Helper_PaginationControl::setDefaultViewPartial (
'paginator.phtml' );
$this->view->paginator = $paginator;

Now in my view file i am getting this:
Start | < Previous | 1 2  3  | Next > |  End   Page 1 of 3

Page 2 and 3 and Next are links, but when i click on them, my browser
reload, but same result is display on the page. Actually i am not 
getting
result for page 2, 3 or next. Same result as for page 1 is 
displayed. How to

fix this?

Thanks,
V
  




Hello Daniel,
How you build your sql query in this case?
If i am doing this:
$sql = "select * from banners where active='y' and programid='" . 
$programid . "' and websiteid = '" . $websiteid . "' and bannertype= 
'" . $bannertype . "'";  //$result = $db->fetchAll ( $sql );

   $paginator = Zend_Paginator::factory($sql);
i am getting an error:


 Error!

Application error


   Exception information:

*Message:* No adapter for type string


   Stack trace:

   #0 
D:\wamp\www\singlescash\application\controllers\BannersController.php(58): 
Zend_Paginator::factory('select * from b...')
#1 D:\wamp\www\singlescash\library\Zend\Controller\Action.php(502): 
BannersController->displayAction()
#2 
D:\wamp\www\singlescash\library\Zend\Controller\Dispatcher\Standard.php(293): 
Zend_Controller_Action->dispatch('displayAction')
#3 D:\wamp\www\singlescash\library\Zend\Controller\Front.php(946): 
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), 
Object(Zend_Controller_Response_Http))
#4 D:\wamp\www\singlescash\application\bootstrap.php(168): 
Zend_Controller_Front->dispatch()
#5 D:\wamp\www\singlescash\index.php(2): 
require_once('D:\wamp\www\sin...')
#6 {main}   


Thanks,
V




[Fwd: [fw-general] Question about zend pagination]

2008-11-17 Thread Daniel Tangermann

Try not to pass the total $result array. Let paginator execute the query.

   $paginator = Zend_Paginator::factory($select);
   $paginator->setItemCountPerPage(10);
   $paginator->setCurrentPageNumber($page);
   $paginator->setPageRange(10);
   $paginator->setDefaultScrollingStyle('Sliding');

   
Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml');

   $this->view->pages = $paginator->getPages();

This case you only query for the element needing (limit,offset).

When linking make certain that you catch the selected like
$page = $this->_request->getParam('page')

Works fine for me

vladimirn schrieb:

I have a problem with zend pagination.
In my controller i have this:
$result = $db->fetchAll ( $sql );
$page = $this->_getParam ( 'page', 1 );
$paginator = Zend_Paginator::factory ( $result );
$paginator->setItemCountPerPage ( 2 );
$paginator->setCurrentPageNumber ( $page );
$paginator->setPageRange ( 5 );
Zend_View_Helper_PaginationControl::setDefaultViewPartial (
'paginator.phtml' );
$this->view->paginator = $paginator;

Now in my view file i am getting this:
Start | < Previous | 1 2  3  | Next > |  End   Page 1 of 3

Page 2 and 3 and Next are links, but when i click on them, my browser
reload, but same result is display on the page. Actually i am not getting
result for page 2, 3 or next. Same result as for page 1 is displayed. How to
fix this?

Thanks,
V
  


--- Begin Message ---

I have a problem with zend pagination.
In my controller i have this:
$result = $db->fetchAll ( $sql );
$page = $this->_getParam ( 'page', 1 );
$paginator = Zend_Paginator::factory ( $result );
$paginator->setItemCountPerPage ( 2 );
$paginator->setCurrentPageNumber ( $page );
$paginator->setPageRange ( 5 );
Zend_View_Helper_PaginationControl::setDefaultViewPartial (
'paginator.phtml' );
$this->view->paginator = $paginator;

Now in my view file i am getting this:
Start | < Previous | 1 2  3  | Next > |  End   Page 1 of 3

Page 2 and 3 and Next are links, but when i click on them, my browser
reload, but same result is display on the page. Actually i am not getting
result for page 2, 3 or next. Same result as for page 1 is displayed. How to
fix this?

Thanks,
V
-- 
View this message in context: 
http://www.nabble.com/Question-about-zend-pagination-tp20543032p20543032.html
Sent from the Zend Framework mailing list archive at Nabble.com.

--- End Message ---


[Fwd: Re: [fw-general] Implementing a Security Access system.]

2007-09-24 Thread Daniel Tangermann

I am having a similar problem.
I have set throwExeptions to false, setup an ErrorController.
It worked fine on a local webserver. I have uploaded it to another 
server, similiar configuration, but now it does not matter if I have an 
errorController or if I throwExeptions - it is not cared at all.


Is there anything that I am missing?
--- Begin Message ---

Hi.

Set /throwExecptions/ to /false/, so Exception will automatically 
forward to ErrorController/errorAction. There you also can display the 
Exceptions not caught by the ErrorController.


Darby Felton schrieb:

Hi Mat,

You might try something like the following:

$request->setControllerName('access')
->setActionName('denied')
->setDispatched(false);

Hope that helps!

Best regards,
Darby

Mathew Byrne wrote:
  

I'm attempting to implement a security system as a Controller plugin. On
each request the preDispatch function checks if a current user is logged
in and then checks their permissions against a list of pages they have
access to.

Is there a good method properly skip the dispatching of the action if
they do not have access? I tried throwing an Exception however if
$front->throwExceptions () is true then the exception is caught, stored
in the response object and the action is still dispatched.

Can anyone suggest a better method that does NOT allow the action to be
dispatched?

Mat Byrne




  


--- End Message ---


Re: [fw-general] Question about View helper attribute support

2007-09-10 Thread Daniel Tangermann
xhtml valid:
 // begin the label wrapper
   $radio = 'for="val'.$this->view->escape($opt_value).'"'

  . $this->_htmlAttribs($label_attribs) . '>'
  . '

Re: [fw-general] Question about View helper attribute support

2007-09-10 Thread Daniel Tangermann

Found it:

FormRadio.php Line 111:
   // begin the label wrapper
   $radio = '_htmlAttribs($label_attribs) . '>'
  . '   $radio = 'for="val'.$this->view->escape($opt_value).'"'

  . $this->_htmlAttribs($label_attribs) . '>'
  . 'view->escape($opt_value).''
  . ' name="' . $this->view->escape($name) . '"'
  . ' value="' . $this->view->escape($opt_value) . '"';


[fw-general] Question about View helper attribute support

2007-09-10 Thread Daniel Tangermann

I noticed the same,
I tried to modify the helper, but it did not work.
Anybody has a solution for that?


Any reason that only some of the helpers support the 'id' attribute and
others don't as in:

FormButton.php:   . ' id="' . $this->view->escape($id) .
'"';
FormCheckbox.php:   . ' id="' . $this->view->escape($id) .
'"'
FormFile.php:   . ' id="' . $this->view->escape($id) . '"'
FormImage.php:   . ' id="' . $this->view->escape($id) . '"'
FormPassword.php:   . ' id="' . $this->view->escape($id) .
'"'
FormReset.php:   . ' id="' . $this->view->escape($id) . '"';
FormSelect.php:   . ' id="' . $this->view->escape($id) . '"'
FormSubmit.php:   . ' id="' . $this->view->escape($id) . '"';
FormText.php:   . ' id="' . $this->view->escape($id) . '"'
FormTextarea.php:   . ' id="' . $this->view->escape($id) .
'"'

do support it while

FormLabel.php*
FormNote.php*
FormRadio.php*

do not?

-km

--
View this message in context: 
http://www.nabble.com/Question-about-View-helper-attribute-support-tf4170670s16154.html#a11865079
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] How to set a session variable and return exactly to caller action

2007-09-07 Thread Daniel Tangermann
I did it this way, but I would change to the form view helpers and code 
everything a little different:












inside:
My_Controller_Action extends Zend_Controller_Action
in the init() I am doing this:
if($this->_request->getPost('lang')){
$this->view->lang = $_SESSION['lang'] = 
$this->_request->getPost('lang');

}
if(empty($_SESSION['lang'])){
$this->lang = $_SESSION['lang'] = 'de';
}
$this->lang = $this->view->lang = $_SESSION['lang'];

This way I can change the language and stay on the same site when switching




> Hi all,
> I have a problem:
> I have to develop an Action that have to set a session variable ( 
switch of
> language  ) and return exactly in the action from where it was 
called.. With

> parameters too..
> For example.. suppose we are in a page being called:
> www.domain.ext/controller/action?param=value¶m=value
>
> So we click on a flag trying change the language. An Action
> ChangelanguageAction will be called.. inside this Action i want to 
set a variable and to return to the previous

> Action..
>
> Any Idea?
>
> Waiting help from all you..
>
> Best Regards to all and very compliments for all..
>
> Mauro Casula.



Mauro Casula schrieb:

Hi all,
I have a problem:
I have to develop an Action that have to set a session variable ( switch of
language  ) and return exactly in the action from where it was called.. With
parameters too.. 

For example.. suppose we are in a page being called: 


www.domain.ext/controller/action?param=value¶m=value

So we click on a flag trying change the language. An Action
ChangelanguageAction will be called.. 
inside this Action i want to set a variable and to return to the previous

Action..

Any Idea?

Waiting help from all you..

Best Regards to all and very compliments for all..

Mauro Casula. 


Re: [fw-general] Modular System with submodules

2007-06-28 Thread Daniel Tangermann
unbelievable that noone ever needed a modularsystem with more than one 
subsection. Or is it just to easy that I do not see the solution?



Daniel Tangermann schrieb:
I finally have a working modular system together with smarty and 
maintemplates.

My file-structure is:

/application
   /modules
  /foo1
 /controllers
  IndexController.php
  /foo2
 /controllers
  IndexController.php
/views
   /scripts
  /foo1
   footemplate1.tpl
  /foo2
   footemplate2.tpl
maintemplate.tpl

I know that in every module there should be a views folder for the 
subtemplates, but this will not work for me together with the smarty + 
maintemplate solution, but this is ok for me right now.

I set up the module-dir in the bootstrap with:
$controller->addModuleDirectory('./application/modules').

Working fine for now, but what do I have to do to have some of the 
modules having seperate modules like

/application
   /modules
  /submodule1
   /foo1
   /controllers
   /foo2
   /controllers
  /modulewithoutsubs
 /controllers

Maybe you can give me a hint.
Daniel




[fw-general] Modular System with submodules

2007-06-25 Thread Daniel Tangermann
I finally have a working modular system together with smarty and 
maintemplates.

My file-structure is:

/application
   /modules
  /foo1
 /controllers
  IndexController.php
  /foo2
 /controllers
  IndexController.php
/views
   /scripts
  /foo1
   footemplate1.tpl
  /foo2
   footemplate2.tpl
maintemplate.tpl

I know that in every module there should be a views folder for the 
subtemplates, but this will not work for me together with the smarty + 
maintemplate solution, but this is ok for me right now.

I set up the module-dir in the bootstrap with:
$controller->addModuleDirectory('./application/modules').

Working fine for now, but what do I have to do to have some of the 
modules having seperate modules like

/application
   /modules
  /submodule1
   /foo1
   /controllers
   /foo2
   /controllers
  /modulewithoutsubs
 /controllers

Maybe you can give me a hint.
Daniel




[fw-general] Redirect - Forwarding - Refresh

2007-06-04 Thread Daniel Tangermann

Situation:
Click on a div makes the div editable -> I edit the text and hit enter 
-> action is /field/add ->

this inserts a row in a table. Works fine.

After inserting I want the site redirect to the prior page or to another 
page.


Redirect or Forward allways loads the page inside this div. I want it 
totally reloaded.

Maybe someone has a hint for me.

Greatings Daniel