Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Pretty cool!  (Read 4030 times)

nvision

  • Newbie
  • *
  • Karma: 1
  • Posts: 5
Pretty cool!
« on: September 17, 2008, 09:06:36 PM »

I just discovered sNews CMS. - Pretty cool.  I am still reading through code and postings to learn how it works. 


There's an aweful lot going on in that one file! I think the most confusing aspects so far are how the URLs work and how the URLs fetch pages.

Question: Is there a posting anywhere that talks about how the URLs work?

Thanks,

Curtis
Logged

Joost

  • Guest
Re: Pretty cool!
« Reply #1 on: September 18, 2008, 01:55:22 AM »

A url like  http://snewscms.com/faq/faq/ is rewritten by the htaccess file to:

http://snewscms.com/index.php?category=faq/faq/

sNews then breaks the get request ($_GET['category'] ) into two parts: 'faq' (category) and 'faq' (article). Then the database is searched for both.


Logged

nvision

  • Newbie
  • *
  • Karma: 1
  • Posts: 5
Re: Pretty cool! More questions on URL values...
« Reply #2 on: September 18, 2008, 04:40:31 PM »

So...

  • I should assume that $_GET['category'] is an expected parameter for all pages in sNews? 
  • Looks like all this magic is contained in the get_id function is that correct?
  • How does sNews handle multiple GET parameters?

Part of my thinking right now is that I would like to use sNews with my existing client site to drive all but the products page.  I have written a products module (not for sNews) that uses its own set of GET variables for Category, Groups and Product Ids and database.   It's quite elaborate and links to a cart.  But I do not have a any way for clients to edit there static content and would like to use sNews. To that end I am need to better understand how to adapt to sNews.

 I think I would have to specify somehow that when the page is "Products" to use my code instead or rewrite entire module.

I have been looking at several CMS's and Frameworks, all seem way too bloated,  way too complex and require a significant understanding of OOP.  sNews is different.  ALthough I'm not entirely sure I agree with the necessity of a single file.  I like to have some division for clarity of code.

 

Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Pretty cool!
« Reply #3 on: September 18, 2008, 05:24:09 PM »

Code: [Select]
<?php
$url explode('/'clean($_GET['category']));
$categorySEF $url['0'];

category=trips/trip-to-malay/
$articleSEF = $url['1'];

but you can have

category=trips/p_2/
In this case, is about page 2 of trips category

so, $articleSEF = $url['1'] only if $url['1'] is not 'p_' ..... Again, the number of pages is extracted removing 'p_'


-----------------------
If you worked with several (distinct) pages you will have problems adapting to one single file ... but depends...
« Last Edit: September 18, 2008, 05:27:32 PM by funlw65 »
Logged