Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-03-2008, 09:13 PM
Junior Member
 
Join Date: Feb 2008
Posts: 4
Default How to call one controller from another controller

For example, my directory structure is some thing like this:

application/
controllers/
teachingphilosophycontroller
patents
views/
scripts/
patents/
hitaps.html
robotics.phtml
teachingphilosophy/
index.phtml

In the patents controller I have two actions named hitaps and robotics. I am using href links for the links on the webpage. I put the href value has teachinghilosophy for the teachingphilosophy link and patents/hitaps, patents/robotics for the hitaps and robotics link for the home page. Like wise I put the links in teachingphilosohy page for the patents such as patents/hitaps and patents/robotics. While in the patents page, when I am putting the href link as teachingphilosophy, its not working.

For suppose, I accesses the patents view files from the home directory, then the url becomes www.example.com/patents/hitaps. If I click on teachingphilosophy link from this page, it is taking the url as www.example.com/patents/teachingphilosophy and giving error that there is no action name in that controller. But there I need to go to www.example.com/teachingphilosophy. I hope some one can help me. Thanks.

Note: the directory structure given above is not spaced properly. I hope anyone can understands it. Its just the normal layout as in zend documentation.

Last edited by sukumar : 04-03-2008 at 09:16 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 12:35 AM
lucasm's Avatar
Junior Member
 
Join Date: Mar 2008
Location: Įguas Claras-DF, Brazil
Posts: 13
Lightbulb

Sukumar,

I missed something... Is your link wright or wrong?
I understood that you link is www.example.com/patents/teachingphilosophy but it should be www.example.com/teachingphilosophy. Did I get it?

If this is the problem, I recommend you to use the url helper (sample above).

PHP Code:
<a href="<?php echo $this->url(array('controller'=>'teachingphilosophy''action'=>'index'));?>">teachingphilosophy</a>
Using this helper avoid you write wrong links in your application.

regards,
__________________
Lucas Mauricio C. e Martins
CR Vasco da Gama, my biggest passion!

Ajude a Combater o Spam! - Help fighting spam!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:35 AM.