@den0x, I am back to this topic..
I have reviewed (again) your snippet very thoughtfully, diving deep into whatever you were trying to achieve with raw php. I have to say, there is too much effort put in place to find a translation for 'Page' word. I am going to replace the whole php thing with a statement -
- Code: Select all
<cms:set page_translated='Page' scope='global' />
Maybe you agree that it's easy for the superadmin to set whatever localized word is desired, because setting it automatically looks a bit weird and an overkill for the task. (Note for @KK to add a word 'Page' to localization files).
In my next effort, I removed several extra cms:pages calls which greatly optimized the code readability and performance. Also, there is a lack of
show_unpublished='1' show_future_entries='1' params, which skips some pages unintentionally. Finally, if user configures list-view of a template by cms:config_list_view, we must follow its 'order', 'orderby' and 'exclude' parameters, don't you agree? I have written a function that helps get those params -
- Code: Select all
<cms:func 'get_config_list' masterpage='' var='' >
When I got the final result of my rewriting (and extra styling to cater for mobiles), I couldn't help myself but test it on a bigger scale template. Of course, cmspages-based snippet failed miserably if the limit was
correct (not 1000/0, but a real one = k_total_records). I have checked my previous sql-version, but it also is not up to expectations, because it is not based on real ranking of pages in list-view (it positioned pages by id, which of course doesn't always look the same as in list-view).
So, I am now back at point blank, with the SQL which assigns each page an incremented position according to the current position of pages in backend.
It is really fast for a 100k list (half a second). Now I am struggling with the next step - I must find a way to squeeze into a single query -
first,
last,
prev,
next markers and retrieve only these 5 (+current page id) positions.