cnb / News_Manager-getsimplecms

A blog/news plugin for GetSimple CMS - development extended version
8 stars 10 forks source link

slugs enhancement: Page To Display Posts #141

Open emanwebdev opened 10 years ago

emanwebdev commented 10 years ago

regarding "Page To Display Posts"

what about the possibility to be able to have the posts on the main page?

instantly turning GS to a blog :exclamation:

cnb commented 10 years ago

You just have to select index as Page to display posts

(I'll create another issue about improving that selector anyway.)

emanwebdev commented 10 years ago

You just have to select index as Page to display posts

Great.

no, sorry, can't find this 'index' option in the Page to display posts drop-down select

maybe got an old version of NM? (currently testing with Version 2.5 beta 16b)

cnb commented 10 years ago

Strange, should be there. Note that pages are not properly sorted in the dropdown (well they're sorted by title instead of slug), if you have many pages you may have to scroll down to find it.

emanwebdev commented 10 years ago

no, nothing?... (only 5 pages)

nm-settings-page to display posts

cnb commented 10 years ago

:-o Any other page not showing up besides index?

Is your index page private? I just realized private pages are not listed in the dropdown. I'll change that (You can make it public, select it and then make private again, but there can be issues if you edit NM settings after that)

issue #142 updated

emanwebdev commented 10 years ago

Is your index page private?

ooops, right, it was private

but can't be displayed !? normal index page showing, not NM's one

emanwebdev commented 10 years ago

still have a slug like

http://gscms/post/news-at-index

while looking for

http://gscms/

or at least

http://gscms/news-at-index

am i looking for something that can't be done? (i guess it's not obvious or not possible to replace the default main GS index page!)

cnb commented 10 years ago

while looking for http://gscms/

I don't understand.

or at least http://gscms/news-at-index

Not currently possible, sorry. The way the plugin is designed all news pages (single post, archives, etc.) except main/home require a parameter/prefix. A possible alternative would be using NMPARAMPOSTto define a short post prefix, like p, to at least have http://gscms/p/news-at-index (or http://gscms/?p=news-at-index without fURLs enabled)

am i looking for something that's can't be done? (i can guess it's not obvious or not possible to replace the default main GS index page!)

Not that it cannot be done, but I think that it would require somewhat different rewriterules in .htaccess besides some changes in the code. But then you couldn't have normal GS pages, only NM posts! (if you select index -- if you do with another slug you couldn't have subpages of that one)

As I commented in another issue, I have in mind adding support for some kind of custom NM URLs now that it's possible (or easier) since GS 3.3.0, that would probably allow what you suggest. But I'm leaving that for later because I want to do some other stuff I need/want.

emanwebdev commented 10 years ago

while looking for http://gscms/

I don't understand.

it's just the root of the website. local dev server and fake domain name. local stuff.

the idea is to land on the website straight to a NM page. would be great. the homepage of the website would change with any new NM's post, like a blog.

emanwebdev commented 10 years ago

But then you couldn't have normal GS pages, only NM posts

hum... other pages would still be available via the navigation menu of the website/theme

(...) that it would require somewhat different rewrite rules in .htaccess

right. bypassing normal GS' index page.

cnb commented 10 years ago

http://gscms/page-or-post How could a rewriterule know if it's a page or a post and pass the appropriate id or post parameter to index.php? (I don't know much about mod_rewrite...)

PS I said you couldn't have normal GS pages but I meant you could create them but they wouldn't be accessible in the frontend.

emanwebdev commented 10 years ago

How could a rewriterule know if it's a page or a post

order, order of the rewrite rule as they are parsed in sequence. First match

cnb commented 10 years ago

But, what would you match?

I mean, if you want post pages to be like: http://gscms/this-is-a-post and also pages to be like: http://gscms/this-is-a-page

I don't think you can have both with rewriterules.

emanwebdev commented 10 years ago

right, you need to specify the EXACT slug in the rewrite rule for the NM slugs at least http://gscms/this-is-a-post would require something like a RewriteRule ^this-is-a-post/?$ index.php?post=XXXX [L] rewrite rule

with XXXX being defined accordingly indeed

hence a clumsy and heavy solution i agree :)

emanwebdev commented 10 years ago

how does WP handle that?

as in WP you can freely switch back and forth between static landing pages and blog/post like landing pages without having to change the .htaccess file

or too have a static pages AND a posts at the same time

cnb commented 10 years ago

I suppose it (WP's PHP code) extracts/parses data from the requested URL without relying on parameters being passed by rewriterules.

That's what I'd like to do with NM later in some future version (that thing I mentioned about custom URLs, possible since GS 3.3.0 with the indexid filter)

emanwebdev commented 10 years ago

I suppose it (WP's PHP code) extracts/parses data from the requested URL

i guess that too. they might take the url, (hash it or not,) and match it against a primary key or the slug (or the hash key) associated with every page / post in the DB

EDIT: It might even be faster than the known relatively slow RewriteRules of Apache after all!

UPDATE:

maybe not after all..... :

i've used mod_rewrite on sites that get millions/hits/month without any significant performance issues. You do have to know which rewrites get applied first depending on your rules.

Using mod_rewrite is most likely faster than parsing the URL with your current language.

If you are really worried about performance, don't use htaccess files, those are slow. Put all your rewrite rules in your Apache config, which is only read once on startup. htaccess files get re-parsed on every request, along with every htaccess file in parent folders.

from http://stackoverflow.com/questions/26559/any-negative-impacts-when-using-mod-rewrite

Well, for under millions/hits/month websites, a good plain old htaccess is fine :yum:

cnb commented 10 years ago

Thanks for the info. As I said I'm leaving this (URL parsing) for later, so I will think a bit more about it before changing anything.