Jump to content

SimonBruce

New Members
  • Posts

    4
  • Joined

  • Last visited

SimonBruce's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. May also be the $id part of the class??? function Get($id){ //No data yet, so start query $this->db = new Database(); $this->db->Execute("SELECT n.*,DATE_FORMAT(n_date,'%D %M %Y') AS fdate FROM news n INNER JOIN users u ON u.id = n.user_id WHERE site_id='{$this->SiteId}' AND n.n_title='".$this->db->Escape($id)."'"); } Sorry... i'm totally lost with my PHP, but it's clear that now the title is being displayed with '-' instead of '%20' the page isnt pulling in content... In particular above i can see that the id for the page is based on a few things including the n_title which we are now displaying differently? Any thoughts would be appreciated
  2. That's sorted the display of the links so thanks! Only problem is that although I'm now directed to the page with a nice clean name in the browser eg /Article-Title instead of /Article%20Title the page isnt rendering and i am presented with a template page without content. If i manually put the %20 back in, it fixed the link and the content appears. Am i missing something in my class or on the article page itself? This is the head of my article page: <?php require_once '../include/config.php'; require_once '../class/news.php'; $id = substr($_SERVER['PATH_INFO'],1); $news = new News(); $news->Get($id); $news->Latest(); ?>
  3. This looks promising! Have changed my link to include your suggested code, but not sure how to amend the class to work. My class for the title looks like this: function Title(){ echo htmlspecialchars($this->data['n_title']); } any thoughts? Thanks!!
  4. Hi guys, I'm new to this site so thought I'd start off with a question regarding something I've been wanting to fix for ages!! We have a custom CMS on our website that produces URLs based on the title of the news article and leaves spaces between the words. For example an article called 'News article title' creates a link like this: <a href="article.php/<?php $news->Title()?>"> Which results in the browser seeing a link like this: http://www.ourwebsite.com/article.php/news article title and once clicked turns to this in the browser: http://www.ourwebsite.com/article.php/news%20article%20title Obviously i'd prefer it to look like this: http://www.ourwebsite.com/article.php/news-article-title I have played around with .htaccess and can get it to change the gaps into dashes, but seeing as the page isn't titled with dashes the link fails... I'm guessing I need to modify my link in the PHP, but this is where my lack of experience shows!! Any advise on how I can change the above to make the URL's cleaner and more SEO friendly would be appreciated!! Simon
×
×
  • 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.