Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3]

Author Topic: [MOD] Additional Article Position Options (sNews 1.5)  (Read 25721 times)

piXelatedEmpire

  • MIA
  • Thread Moderator
  • ULTIMATE member
  • *****
  • Karma: 37
  • Posts: 1454
  • currently MIA
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #30 on: January 05, 2007, 08:05:26 AM »

For those interested, I also slightly changed the positioning of the 'second Extra contents' link in the Admin panel so that it appears directly underneath the 'Extra contents' link.  Seems to make more sense to me to have it here.  To do this:

follow Dom's instructions until you get to this part:
Quote from: Dom
Now search for function administration()
At this stage, find this line:
Code: [Select]
if (stats('articles',2) > 0) {echo $link.'extra_contents/" title="'.l('view').'">'.l('view').'';}and directly below it add this code:
Code: [Select]
echo '

';
    echo '

'.l('second_extra_contents').': '.l('add_new').'';
if (stats('articles',9) > 0) {echo $link.'second_extra_contents/" title="'.l('view').'">'.l('view').'';}
That's it!  Your admin panel should now look something like this:


I know I know, not much of a change, but maybe someone will find it useful!

Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

Dom

  • Full Member
  • ***
  • Karma: 5
  • Posts: 166
    • domdelimar.com
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #31 on: January 05, 2007, 03:20:46 PM »

Incidentally, just yesterday I've placed one Second Extra Content on my testing site for the first time on the homepage and that's exactly what's been bothering me so I was thinking... do we want to move it completely out of our sight when we're logged in? I don't think so. Maybe a JavaScript toggle function would be great here to just hide it, with a way to quickly show it again.

That was the initial thought and after I accomplished this I realized we don't need a quick fix here and that I'd be more satisfied if Extra Content made to show up on homepage wouldn't show up on admin pages, wouldn't you agree?

Now, let's just say this was a bit confusing and I've been looking at 'case' lines in original extra function all along but the solucija was lying somewhere else...

Let's look at some facts first (was working with original Extra Content from sNews here):
Fact 1: created Extra Content to show on Home category
Fact 2: Extra Content now has position value 210 and category value 0
Fact 3: Extra Content shows on the following pages: homepage, Articles and Pages under home category & of course on all hard-coded pages
Fact 4: Mika's explanation from snews-commented.php says that if the position value starts with '21', then that's a category dependent Extra Content

For me, when I created and applied this mod it made sense that if I wanted to show a category introductory text, it should not be visible on all the pages 'below' that category as well. So I modified my extra function a bit more which is explained here as another mod.

Now, it looks like I covered all the cases but the case when the category that an extra content is dependent on is Home category. Reason for this is that I didn't know how to do it. Ha! :/

Fact 5: applying this other mod makes the Extra content show on the following pages: homepage, all hard-coded pages BUT not on Articles and Pages 'below' the Home category

I guess my other mod does work in some extent, it's just that I disregarded the hard-coded pages, which should be treated the same as Article and Pages (this is not going to sNews developers, as it's valid just for this modification) and that is if I want to show extra content on category index page, just as on the Homepage, I don't want it to be visible on other pages below that category (including other Articles, Pages and all hard-coded pages).

The 'problem' lies here:

$categoryId variable inside extra function is set to '0' whether the page is hard-coded or "home", either way. Basically, that way extra function sees hard-coded pages as if they were the Homepage. We need to set $categoryId to '0' ONLY when category is home:

Find this line inside your extra function:
Quote
$categoryId = (check_category($categorySEF) == true || empty($categorySEF) || $categorySEF == s('home_sef')) ? 0 : retrieve('id', 'categories', 'seftitle', $categorySEF);
And replace it with the following one:
Quote
$categoryId = (empty($categorySEF) || $categorySEF == s('home_sef')) ? 0 : retrieve('id', 'categories', 'seftitle', $categorySEF);
Fact 6: when I apply the above solucija, Extra content shows on the following pages, hmm, on the following page: homepage - success! Finally. ;)

Question 1: Does this have any other side effects on the way extra function should work? I haven't seen any so far.  :D
Logged

Dom

  • Full Member
  • ***
  • Karma: 5
  • Posts: 166
    • domdelimar.com
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #32 on: January 05, 2007, 03:22:46 PM »

Oh, BTW Adam, your other comment about the position of the 'second Extra contents' link in the Admin panel makes sense. I'll update my first post (and files immediately after that) ASAP. Gotta run now. Thanks!
Logged

Datu Puti

  • Newbie
  • *
  • Karma: 0
  • Posts: 43
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #33 on: January 05, 2007, 09:15:37 PM »

Dom u got a clean snews.php file with the third extra function updated, for download?
Logged
Regards from the beautiful 7000 Islands of the Philippines! Mabuhay!

Dom

  • Full Member
  • ***
  • Karma: 5
  • Posts: 166
    • domdelimar.com
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #34 on: January 05, 2007, 10:56:45 PM »

Hi ilocoskid, everything looks fine from my side - I tried downloading all the files and they all contain full snews.php files - snews.php with the third extra function pre-installed you should download from http://domdelimar.com/goodies/snews.zip. Could it be that you tired downloading exactly at the moment that I've been uploading it today? It happens sometimes to me when I try to re-load my homepage and the snews.php is still being uploaded to server. Other than that I don't know what it could be.
Logged

Dom

  • Full Member
  • ***
  • Karma: 5
  • Posts: 166
    • domdelimar.com
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #35 on: January 05, 2007, 11:01:21 PM »

Hmm, I've just checked the error log and found some strange errors (to me at least, because I don't exactly know what they mean) and I suspect this was you trying to download that file:

[20-Dec-2006 22:02:46] PHP Warning:  Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
[20-Dec-2006 22:02:46] PHP Warning:  mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'localhost' (using password: YES) in /****/public_html/goodies/snews.php.download on line 1687
[20-Dec-2006 22:02:46] PHP Warning:  mysql_select_db() [function.mysql-select-db]: Access denied for user '****'@'localhost' (using password: NO) in /****/public_html/goodies/snews.php.download on line 1688
[20-Dec-2006 22:02:46] PHP Warning:  mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /****/public_html/goodies/snews.php.download on line 1688
[20-Dec-2006 22:06:00] PHP Warning:  Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
[20-Dec-2006 22:06:31] PHP Warning:  Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
[20-Dec-2006 22:09:14] PHP Warning:  Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0

Try with the simple right-click and the "Save As.." on the link from my previous post.
Logged

Datu Puti

  • Newbie
  • *
  • Karma: 0
  • Posts: 43
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #36 on: January 06, 2007, 06:12:32 PM »

ok dom.. thnx.. i haven't downloaded anything until just now.. thnx again..
Logged
Regards from the beautiful 7000 Islands of the Philippines! Mabuhay!

Dom

  • Full Member
  • ***
  • Karma: 5
  • Posts: 166
    • domdelimar.com
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #37 on: January 07, 2007, 07:48:25 PM »

Answer to my question: Does this have any other side effects on the way extra function should work? - is: YES!

Sorry, I hoped that this solved the problem but it didn't.
I completely forgot about the things like when you search, use the contact form or write a comment - after each of these actions the result is brought onto your homepage. OK, it's not really your homepage content shown, but the address bar says you're on the homepage. And the extra content just gets in way there.

Choosing a Page to behave as Home Page instead isn't a solucija because it then kills the purpose of having an extra content on Home Page, along with whatever the center function shows (one or a number of latest articles).

So... I need some help now... pretty please...
The only solucija I see is to have sNews show the result of the mentioned actions (search, comment posting and using contact form) on URLs other than homepage URL. Any other ideas?

Until we solve this, the mod 'Showing extra content only on category index' is useless for extra content dependent on homepage category. Hmm, I'd better move this problem at this topic... so if you have a suggestion or a solucija, come here.
Logged

Pavel

  • Newbie
  • *
  • Karma: 0
  • Posts: 30
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #38 on: June 17, 2007, 01:21:00 AM »

Can someone please create this mod for sNews 1.6?  ;)
Logged

Dom

  • Full Member
  • ***
  • Karma: 5
  • Posts: 166
    • domdelimar.com
[MOD] Additional Article Position Options (sNews 1.5)
« Reply #39 on: July 08, 2007, 06:09:43 PM »

Hi, I have finally had an opportunity to dedicate some time to this problem.

And it was about time I deal with this - busy offline schedule and the situation I'm currently in (as explained on my website) didn't allow me to do it before.

It turns out I didn't even need the time I anticipated I will need. ;)

Anyway, let's get down to it.
So far I have migrated my website from 1.5.31 to 1.6.0. Yes, I haven't even been able to find some time to do that until now.
Anyway, since I have this mod on my site, I have had the opportunity to see why you might be having problems after migrating yourself (given that you have kept this mod after the upgrade). The only problem I noticed was that I couldn't view existing nor create new Second Extra Contents through Admin area.

Oh, boy did I ponder on this one... and it's so easy... after one figures it out ;)

I just had to add 'second_extra_new' and 'second_extra_contents' as hard-coded categories in SYSTEM VARIABLES, like this:

Quote
$l['cat_listSEF'] = $l['home_sef'].',archive,contact,sitemap,rss-articles,rss-pages,rss-comments,login,administration,
admin_category,admin_article,article_new,extra_new,page_new,categories,articles,extra_contents,
pages,settings,files,logout,second_extra_new,second_extra_contents'; //SEF links of the hardcoded categories
(*Note that I had to cut this line of code into three lines of code just for it to show up correctly on this forum - in your snews.php file this is only one line of code.)

And it took me two hours of going through various functions to figure that out.

Other than not being able to view Second Extra Content from admin area and create a new one, is there anything else not working as it should, Pavel?

I now have to go through the old instructions and see if most of it is good for the new version of sNews. Then I'll make a separate post with instructions for 1.6.0. Expect that in a few days.
Logged
Pages: 1 2 [3]