php substr and the_title()
-
Hullo
.
I want to take the_title and insert two characters at the second last position in the string.
.
example: tom/2004-06-18/50 –> tom/2004-06/t/50
.
It’s for use with a photo album, where the /t simply refers to a directory with a thumbnail for the image. The code I wrote isn’t working. I don’t know jack about php, I’m still in java mode.
.
<?php echo $image = substr(the_title(), 0, -2), ‘t/’, substr(php_title(), -2, 2) ?>
.
For example, if the_title was TOM, this code would return TOMt/TOM, when I want Tt/OM. Then I figured that maybe I should put the value returned by the_title() into a variable. Again, I don’t know what I’m doing.
.
<?php $addy = the_title(); echo $image = substr($addy, 0, -2), ‘t/’, substr($addy, -2, 2) ?>
.
Throw me a friggin bone here.
.
Thanks.
The topic ‘php substr and the_title()’ is closed to new replies.