Hi there,
I am working on my url to make it pretty. and here is the logic i came up with.
now in the url i want to achieve something like this.
http://domain.com/category/date/post-title
for that i first populated the value from the database, i.e date and the post title like this
for date:
$date = date("d", $row['timestamp']);
$month = date("m", $row['timestamp']);
$year = date("Y", $row['timestamp']);
$date_url = $date.$month.$year;
for title:
$title = $row['title'];
$title_url = str_replace(" ", "-", $title);
now i created a hyperlink to send it to URL like this.
<a href="news.php?id=<?php echo $id; ?>&cat=<?php echo 'news'; ?>&date=<?php echo $date_url; ?>&title=<?php echo $title_url; ?>"><img src="<?php echo 'admin-login/'.$pic_title; ?>"/></a>
my main concern is the title, which i am populating the value from the database, is it ok to use str_replace()
for this? or is there any better way?
do i go wrong anywhere or it is fine to go ahead with this logic?
thank you..