Some beginners eclipse questions - php

I have recently ditch Dreamweaver as my IDE for my web projects and I'm currently using Eclipse. My current web project is written in PHP, but I'm not so familiar with Eclipse yet. I downloaded the Eclipse PDT. which has all the PHP developer plugins. And my first questions when I start a project does it mean I'm creating a root folder? and shall I choose PHP project or static web project? I've choosed the PHP project,but I just need to know that I'm not choosing the wrong one.
And why is it showing an error(an exclamation mark) when I try to add some javascripts to my index.php file?
<script type="text/javascript" src="javascripts/addTools.js"></script>
when I hoover over the exclamation mark I get the following info:
Multipel annotation found at this line:
-starttag of element script
-undefined attribute name (src)
-undefined attribute name (type)
-endtag of element script
As far as I know I have used the correct syntax for adding external javascripts to a html. Seems like a bug?
I can still run the website but it is just an annoying moment, pls help me anyone?
REQUESTED SCREEN DUMP:

static web project is for a web project with only html pages. No dynamic pages with php for instance. You choose the good one.
The syntax seems correct, could you show us the full code, or even a screenshot of your editor? It seems the editor is not aware about the html dtd.

Related

Is firefox can trace the file and its location

I'm working on a project on localhost. Its kind of a company management application based on some php framework. Basically I'm a front-end developer and I've to fix some pages, their alignments and color scheme. I'm using firefox. Every single time when I've to change the settings of any page I've to go the php dev who built the app and they located file for me in the project, obviously they knew the file structure of the whole project. So is there any possible way, tool, addon or plugin that can identify the specific file (which is currently open in my browser) for me? so that I can reach the file on localhost directly and edit it right away rather than bothering the php developers all the time. Firefox inspect element can identify the css files though. Any help would be appreciated. Thanks

CSS Icons are working locally in the app, but are not showing on Heroku?

So I have this app, just deployed on Heroku: http://jobsboardd.herokuapp.com/
And as you can see, instead of some fancy icons there are some strange symbols(rectangle)? I know it's a common thing with ruby apps, and I couldn't find anything related to php.
And according to the html code, every css file is loaded as it should. So what can be causing it and how i can fix it?
As I've check in the site's code, you are using HTML Kickstart Toolkit. The Icons that you are looking for belongs to another plugin called font-awesome. See if all the files in the css and fonts are accessible and mapped correctly. I've noticed when I check in the browser's developer console that this image is missing so its possible others are not accessible as well.

Aptana autocomplete shows only local stuff

I am trying out Aptana for general PHP development, i loaded an old CakePhp project to test the autocomplete and all i can get are the local functions and variable and absolutely none of the inherited ones, which kinda ruins the whole thing. Is there a setting i dont know about that fixes this?
apparently i needed to set up a "Nature" to PHP, the default was some eclipse.something version. Aptana reindexed the file and it works now.
The original poster was correct in adding PHP to the "Nature" of the project, however he did not provide how to do it. I also had the same problem and once I added PHP to the "Nature" selection list the autocomplete provided the options for inherited classess as well.
To add the PHP Nature:
Right click on your project in the Project Explorer View
Click on Properties
In the "Properties for project" window, select Project Natures in the left list box
In the Project Natures window, place a tick next to PHP
Click on OK button
that should get you the autocomplete list.
AJ
I haven't used aptana for PHP, but since it's based on Eclipse I assume the cake folder (in the same level as your app folder usually) needs to be added to your project path.
You can go into the properties of your project and either add it to the path or add it to the libraries.
I usually setup my project to point to the whole folder so I don't need need to do this step, but my Eclipse installation will pick up the inherited methods just fine.

How do you find the block of code you are looking for in Magento?

I have been struggling with a stupid situation. A customer has asked me to alter his 'advanced search' page to add a few options. The URL of this page is like http://www.domainname.com/index.php/catalogsearch/advanced/
This is a Magento store and I have no experience with this framework. I tried to learn it but found the learning curve too steep to gain enough knowledge to finish the project on-time.
So I first made a small PHP tool that searches in all source files for a search term and reports back te number of hits. I used this tool to look for unique strings that appear on the advanced search page. But the text is nowhere to be found!
My next attempt was looking at the database to find the string. So I exported all DB data and copied the resulting queries into my code editor and searched again, and found nothing!
This is very awkward and is driving me mad. I cannot find the block of code that outputs the advanced search options!
'ANY' help would be MUCH appreciated.
Thanks,
Majid
So far I've been using the following tactics on a local dev box - don't try this on a live store obviously!:
Turn on Template Path Hints + Block Names in System -> Config -> Developer. This will get you to the phtml file that does the final render and also the block object type that it uses. Unless you've IP limited this, every visitor will see these!
Then in the phtml files to dig further you can easily Zend_Debug::dump($var) to inspect the variable/object in question and find the object type etc.
Search in your editor or grep through /app/code directories to find which files define the object type you've just found - although as it based on Zend the correct file path can be worked out most of the time from the object class.
Also
A handy trick is to deliberately insert an error in a php/phtml file, Magento gives you a nicely formatted error screen with a call stack which is interesting reading
echo() statements in the core files normally work pretty well, in the Magento set up they don't normally trigger the html headers to be sent at the wrong time
Use an IDE like Netbeans/Eclipse/Zend studio etc and put all the Magento code into your project, the resulting phpdoc information, 'open declaration' and code assist will save you hours of searching
Spend the time to get Xdebug working on your test server with an IDE that allows you to make use of it. The easiest one I've found to setup from scratch (on a Mac) is a local Mamp install with Netbeans as the IDE - the Netbeans site will walk you through this, once you've got this working well you can forget about most of the other tricks!
These are just the things I've tried so far - more suggestions please!
I've still not found a technique to debug config problems from XML issues in the multitude of XML files that Magento uses, problems here tend to fail silently and are really hard to track down as a result + the xml documentation is awful.
The URLs in Magento tell you where the template files are for a certain module.
For example, when you're looking for catalogsearch/advanced/, all template files are location in app/design/frontend/default/your-theme/.
Look inside that folder and it should be obvious. You will have a folder called catalogsearch and inside that a folder called advanced; inside which there are two files:
form.phtml
result.phtml

CodeIgniter with Eclipse PDT, is clean integration possible?

I am attempting to setup codeigniter with eclipse but am getting project errors. From what I understand this should be as simple as creating a new project in eclipse and pointing to the root directory of codeigniter. This properly loads up the codeigniter files but eclipse reports several errors. Looking into the files, it seems like the errors are coming from html files and/or files that print html. For instance, footer.php is showing up as having an error because there is a closing tag but no opening tag. Any suggestions on how to overcome this? At this point would code completion / debugging be too much to ask for as well?
UPDATE: so from what I am gathering from the response below (and searching around on the web) is that when using codeigniter with eclipse one can only take advantage of the code completion / editing features? I also noticed that I am getting NoClassDefFoundError when attempting to open some of the .php files in the eclipse project tree for editing. Surely I must be missing something and there is a way to achieve tighter integration with codeigniter and eclipse? (i would strongly prefer to stick with eclipse as opposed to switching ides) Or maybe this is an issue with my eclipse/pdt setup?
UPDATE 2: I just downloaded the latest eclipse version (galileo) and it seemed to fix all of these issues! except for debugging of course ...
you can achieve tighter integration by initializing the Ci core classes in CI_Base constructor which will also allow you to get auto complete for core classes check out these links:
http://www.gostomski.co.uk/codeigniter/getting-full-auto-complete-with-codeigniter-in-eclipse
http://hetal.wordpress.com/2009/09/04/working-with-eclipse-and-code-igniter/
you will get lots of html errors because the html has been broken into chunks
and is not a complete document
just ignore them thats what i do (there are settings somewhere that control what errors are validated against in eclipse)
i still use the php/html/js code completion and it works fine even with the errors
if you are using svn version control, add subclipse plugin, so you can do that from within eclipse too
Try Aptana.
The last time I checked I was able to do a step by step debug on it and did not see any errors in my project. It is also built on eclipse, so there is nothing new to learn.
For what it's worth, I have been able to get debugging to work using XDebug and the Netbeans IDE. If you cannot get debugging to work in Eclipse you might give Netbeans a try - if for no other reason, to have the ability to debug should you ever need to step through your application's code...

Categories