I am working on my url to make it beautiful. and here is the logic to which I have come.
now in the url I want to achieve something similar.
http://domain.com/category/date/post-title
for this, I first populated the value from the database, that is, the date and 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);
I have now created a hyperlink to send it to a 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 problem is the header, which I fill with the value from the database, is it normal to use str_replace()for this? or is there a better way?
Am I mistaken anywhere, or is it good to continue this logic?
thank..
source
share