Solved

PHP5 / Zend: mouse click, then jump into related source codes

Posted on 2011-02-24
9
226 Views
Last Modified: 2012-05-11
hi all,

it is about developing php5/Zend project under Netbeans.

i usually click on the code by using right mouse "Navigate->Go to Declaration" to see the related source codes. It works fine when i do this in .php file.

the problem i met is:  "Navigate->Go to Declaration"  doesn't work in .phtml file. For instance, i have code in .phtml file like:

$this->cycle()->next();

as i use  "Navigate->Go to Declaration"  on these codes, nothing happened.

Are there any way to find out the Declaration of the codes in .phtml file? (in this case, i would find out what $this, cycle(), next() related to.  I know that one can get it out by using debugger, but is it possible by using mouse click with  "Navigate->Go to Declaration" ?)

thanks,
wantime
0
Comment
Question by:wantime
  • 7
  • 2
9 Comments
 
LVL 10

Expert Comment

by:ollyatstithians
ID: 35239550
Hi,
I am not familiar with Netbeans specifically, but have you checked that your library code (ie. Zend Framework) is included in the IDE?
I think it is in Tools>Options>General tab.
0
 
LVL 10

Expert Comment

by:ollyatstithians
ID: 35239897
Correction:
Add your Zend Framework "library" directory to the list in:
Tools>Options>PHP>General
0
 

Author Comment

by:wantime
ID: 35240753
thanks.

the library code is there like you said.

"Navigate->Go to Declaration"   works in *.php files, but it doesn't work in *.phtml. Is it normal or not?

0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 10

Expert Comment

by:ollyatstithians
ID: 35241134
I have checked on Netbeans, and you are right.
I think it may be due to a difference between objects explicitly created and those created by factory methods (ie. the IDE can't find the declaration because it does not really exist in the code). It may also be due to the use of overloaded methods (__get() and __set()). I have experienced this before using Eclipse PDT.
I am not sure what you can do about it, other than just browse through the library manually for that class and method. On the up side, your view scripts should be simpler anyway.
0
 
LVL 10

Expert Comment

by:ollyatstithians
ID: 35241175
Not the best answer i'm afraid. :(
0
 

Author Comment

by:wantime
ID: 35258676
are there anyother IDE to do this?
0
 
LVL 10

Expert Comment

by:ollyatstithians
ID: 35258850
I think most IDEs will hit this problem. Eclipse PDT certainly does.
You could try Zend Studio, as they may have enhanced its ability to deal with ZF, but it is expensive. There is a free demo though.
0
 
LVL 10

Expert Comment

by:ollyatstithians
ID: 35258931
Here is a bug report from Netbeans which pretty much sums it up:

http://netbeans.org/bugzilla/show_bug.cgi?id=190861

There is an apparent workaround at in the last post, but if you can figure out how to make it work, let me know. :(
0
 
LVL 10

Accepted Solution

by:
ollyatstithians earned 500 total points
ID: 35258983
Looking around, it seems that Zend Studio DOES support code completion in .phtml files.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question