Sometimes little tips can save a lot of time when it comes to programming.
This one is very handy, for when you find yourself having to grab some code you had written in regular html and change it to be called by a php echo statement.
When I had to do this in the past, I found the biggest time drain was escaping all the quotes (Otherwise the first quote in the html would stop the echo call prematurely.)
Well here is an incredibly easy way to avoid having to do that …. simply use single quotes to define your echo call and then your double quotes won’t break the php code.
For instance you have a simple linked image like this:
<a href=”http://www.link.com” target=”_top”><img src=”/image.gif”></a>
Normally you would have to escape all those quotes like this:
echo “<a href=\”http://www.link.com\” target=\”_top\”><img src=\”/image.gif\”</a>”;
Instead just use the single quotes like this:
echo ‘<a href=”http://www.link.com” target=”_top”><img src=”/image.gif”></a>’;
Comments Off on Tired of escaping quotes in your php echo statements?
Just thought I would mention how handy Firefox’s built in Error Console feature is for debugging – I mostly use this for Javascript, in fact I can;t even remember using it for anything else.
But in any case if you run into the same problems I do with Javascript this is a handy tool for catching the issue at ahnd.
To bring up your Error Console just choose Tools > Error Console from the Firefox top menu.
Then go to the page where you suspect your problem and the console will give you clues.
I have also installed Firebug add-on which looks to have a load of potential for more detailed debugging, but I haven’t really spent enough time on it yet to tell you my thoughts. I will eventually.
Comments Off on Firefox’s Error Console handy for quick debugging of JavaScript
Ever had people gripe because the second line of a list item doesn’t align under the bullet correctly? (This is only a problem in IE by the way – Firefox does the work for you.)
So here is an example of the problem (remember if your not viewing in IE you won;t see anything wrong.) :
Over 50 years of staffing
industry knowledge
Here is how I fixed it, first the code:
<li>Over 50 years of staffing </li>
<li class=”bullet-hidden”><span class=”bullet-visible”>industry knowledge</span></li>
Then the CSS styles:
.bullet-visible {
visibility:visible;
}
.bullet-hidden {
visibility:hidden;
}
If for some reason you can define the style sheets or don;t want ot you can do it directly in the code as follows:
<li>Over 50 years of staffing </li>
<li style=”visibility: hidden;”><span style=” visibility:visible;”>industry knowledge</span></li>
And abracadabra:
Over 50 years of staffing
industry knowledge
Comments Off on Lining up wrapped text on bullet lists