SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 34 of 34
  1. #26
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chroniclemaster1 View Post
    But isn't that true in every case? Every .php page is just XHTML, CSS, and Javascript. No browser in the world processes or even understands PHP or any other language, that's why they're server side.
    Yeah, that was the point I was trying to make. You shouldn't name urls .php - you should name them .html .js .css respectively.

    Quote Originally Posted by Luke Morton View Post
    Is performance not impacted by using an interpretation script of your own compared to using .htaccess or httpd.conf to route scripts?
    Likely not. You need to start up the php interpreter in any case, so running that matching logic in php or in mod_rewrite doesn't make a difference.

  2. #27
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Luke Morton View Post
    Is performance not impacted by using an interpretation script of your own compared to using .htaccess or httpd.conf to route scripts?
    Having all the routing logic in PHP itself allows for greater flexibility. And much easier to maintenance, this also makes the application more portable to different servers. Some may not have a mod_rewrite avalible so then you must use "index.php/some/mvc/path". In any case, having the smallest .htaccess as possible will speed things up. Apache reads the .htaccess with every single request!
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #28
    SitePoint Member
    Join Date
    Dec 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Luke Morton
    Is performance not impacted by using an interpretation script of your own compared to using .htaccess or httpd.conf to route scripts?
    What kyberfabrikken said above is correct. Plus, the performance impact is negligible compared to other things a script might do, like querying a database or opening a file.
    Caffeine Web Framework - reinventing the wheel since 2004.
    MicroWSS - simple SOAP web services server in Java.

  4. #29
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wanted to throw another question into this discussion: how do people store their clean/'good'/seo-friendly urls? I currently have a "locations" table in my database (maybe better named "routes"?) that contains a class name and a url. That does lead to a lot of duplication though:

    Code:
    id  class  url
    1  Page   /page1/
    2  Page   /page1/page2/
    3  Page   /page1/page2/page3
    The least duplication would be to construct the url based on a 'url name' or 'slug' of each content item, but that's difficult to do sometimes. I opted for a little duplication up front, at the cost of having to update the locations table each time a content item's url name/slug is edited. (Where did the name slug come from?)

    So.. any best practices here?

  5. #30
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Personally, I keep the 'friendly urls' in whatever table relates to the resource - eg, for news items, it would go in my news_items table or something as friendly_url, with maybe domain.com/news/news-item-title-here/ as the url.

  6. #31
    SitePoint Member coffeemaniac's Avatar
    Join Date
    Jul 2009
    Location
    Metro Manila, Philippines
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    am learning a lot in this post. keep em coming. the exchange of information is constructive.

  7. #32
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Location
    Germany
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chroniclemaster1 View Post
    But isn't that true in every case? Every .php page is just XHTML, CSS, and Javascript. No browser in the world processes or even understands PHP or any other language, that's why they're server side.
    Actually thats not true, well at least not totally. It really depends on your application. It could serve anything, starting with XML, JSON, other MLs, PDFs, Word Documents, Images, and even other programming languages code (eval anyone?). If you want to serve your php file with the standard file extension from the content that is returned, you will have a lot to configure ...

  8. #33
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by frabron View Post
    Actually thats not true, well at least not totally. It really depends on your application. It could serve anything, starting with XML, JSON, other MLs, PDFs, Word Documents, Images, and even other programming languages code (eval anyone?). If you want to serve your php file with the standard file extension from the content that is returned, you will have a lot to configure ...
    The point was that whatever the file returns, it's probably not php code (Well, in theory it could be, but we're talking about those other cases). This is misguiding the client (browser), who is only really interested in the content-type of the response.

    Quote Originally Posted by frabron View Post
    If you want to serve your php file with the standard file extension from the content that is returned, you will have a lot to configure ...
    you can't use the default page-controller paradigm of Apache, no. But if you use a front controller, it shouldn't be a problem.

  9. #34
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    967
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oeyvind View Post
    Everybody keeps talking about clean URL's, but I'm not so sure that their URL's really are clean..
    I think of a clean URL as being a URL that is easiest for a user to reference and easily searchable by search engines.

    This would be easy to reference: example.com/widget
    it doesn't matter whether it has an extension for this purpose.

    Also, there can be logic in the url that can help users:
    example.com/author/stephenking

    e


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •