CodeIgniter Forums
An evil timesaving secret for all! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: An evil timesaving secret for all! (/thread-1752.html)



An evil timesaving secret for all! - El Forum - 06-24-2007

[eluser]Phil Sturgeon[/eluser]
Wanna know how to save yourself 3 months of your life in code-time?

Stop writing <?=base_url();?> all the damn time and use /, will save you AAAAAAAAGGGGGGGGGEEEEEEEEESSSS/ Im unsure why so many people keep doing this, seems crazy to me :p

I guess many people don't know about it.

Remember:

Quote:<a href="/">Go Home!</a>

Does what it says on the tin!


An evil timesaving secret for all! - El Forum - 06-24-2007

[eluser]CI Lee[/eluser]
However if you have your CI app, lets say a blog, living in /blog and have reflected that in your config.php file then your shortcut above would take you higher up then you want to go. Also if you want your app portable then using "base_url()" means less going back and fixing things later.

I see your point and I agree, so long as it is feasible; that shortcut could come back and bite you in the ass later and well its not such a short cut then.

-Lee


An evil timesaving secret for all! - El Forum - 06-25-2007

[eluser]Crimp[/eluser]
Here's another tip: Get a text editor like BBEdit and make your own CI clippings for most code. Not just tiny hard-to-type snippets like $this-> and -> and => and so on, but whole Class and Model and comment setups. I put a long //---&gt; divider between classes with Ctrl-D and insert a comment template with Ctrl-*. Sprinkle with #SELECTION# and #INSERTION# options and your whole input arrays, for example, are done in 10 keystokes instead of 200. Thus: &lt;?=base_url();?&gt; = / = 1 keystroke. The added benefit is that it cuts down on annoying PHP errors due to simple typos.