Jump to content

Recommended Posts

Oh this is pretty, actually really easy to do. Basically you need to tell php to "stop" echoing. You do this by removing the quotes. Here take a look:

 

$foldername = "asdf";
echo ''.$foldername.'';

 

 

 

Your code just needs a minor adjustment to work  ;)

 

$foldername = "asdf";
echo '' . $foldername . '';

Thanks :)

 

BTW, I was wondering if capitalising the characters in standard PHP functions make a script slower?

 

Does it treat it as a seperate function, have to check the code for case-sensitivity; or are functions case-insensitive?

 

Sorry to go off-topic but I like to use this method to make it more readable and have always pondered the above, thanks for any answers.

Does it treat it as a seperate function, have to check the code for case-sensitivity; or are functions case-insensitive?

 

No functions in PHP are not case-sensitive.  Being a Java developer, I tend to do the same thing.  I believe this style of naming is referred to as CamelCase.

just a note, this works fine for names with no spaces, but if there is a space the output for this

$foldername = "Pan Cakes";
echo '<a href="media/music/' . urlEncode($foldername) . '">' . stripSlashes(htmlEntities($foldername, ENT_QUOTES)) . '</a>';

 

is Pan+Cakes

leading to a dead link.

is Pan+Cakes

leading to a dead link.

 

Make your folder names have - or _ in them, so Pan-Cakes  I take it you want to do this for SEO Reasons. That is the best way to do it. A space is not kosher as it breaks the structure to say and causes you to have to use %20 for it to work.

 

Convert your folder names to have - or _ in them whereever there is a space, then you can simply use a str_replace on space characters and convert them to whichever character you have chosen.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.