url string change
Posted: Tue Aug 09, 2011 1:09 pm
I trust you'll see from below that field values are taken and before use/display the first letter is removed. This first letter is an ordering attribute.
Also, field values 'names' are transformed into lower case and spaces transformed into hyphens, to be used as urls.
What I need to do as well, is to remove that initial character from the url string.
I've tried applying the same technique, but it doesn't produce the correct result.
Any suggestions very gratefully received. This is my first foray into php . .
Thanks
Also, field values 'names' are transformed into lower case and spaces transformed into hyphens, to be used as urls.
Code: Select all
<?php $region = get_post_meta($property_id, 'region', $single); ?>
<?php $region2 = get_post_meta($property_id, 'region2', $single); ?>
<?php $capacity = get_post_meta($property_id, 'capacity', $single); ?>
<?php $class = get_post_meta($property_id, 'class', $single); ?>
<!-- change name to lower case, change spaces to hyphens, for url use -->
<?php $regionurl = strtolower($region[0]);?>
<?php $region2aurl = strtolower($region2[0]);?>
<?php $region2burl = strtr($region2aurl," ","-");?>
<!-- REMOVE FIRST, ORDERING, LETTER FROM URL - HOW ?? -->
<!-- remove first, ordering, letter from name -->
<?php $class9[0] = ltrim($class[0],"a..z");?>
<?php $region9[0] = ltrim($region[0],"a..z");?>
<?php $region29[0] = ltrim($region2[0],"a..z");?>
<?php echo "Category : $class9[0]"; ?>
<br/>
<?php echo "Location : <a href='http://www.french-waterways.com/region/$region2burl.html/'>$region9[0]</a>"; ?>
<br/>
<?php echo "Region : $region29[0]"; ?>
<br/>
<?php echo "Capacity : $capacity[0]"; ?>
I've tried applying the same technique, but it doesn't produce the correct result.
Any suggestions very gratefully received. This is my first foray into php . .
Thanks