Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Excluding function extra() (showing/hiding depending on mouseclicks)  (Read 6920 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com

Thing is I have made that function extra() to appear, and I have made a "welcome" message to appear on HOME category, with me so far ?

Now this greeting do appear, as far as categories go, only on HOME, but... Here's the thing, if I do create a PAGE of my own, it appears there aswell (by default), which I do not want... (it do also appear on archive, contact, and site map and when clicking "read more" on articles AND inside admin area.)... I'm to say the least welcomed to death. :lol:

So I tried a little snippet from way back when:
Quote
<? if (get_id('article') == "" AND get_id('archive') <> "contact" AND $_GET['action'] == "") {?>

<div id="extra_content">
<?php extra(); ?> 
    </div>


<? }else{ ?>
normally someother code here, but in this case empty since I don't want extra to appear at all.
<? } ?>
Blue - normal XHTML code | Black - The snippet which should make it work  | not important

Now, this DO work with man made PAGES, and the clicking of articles and while in editing mode but... The admin area, archive, contact, and site map still shows the HOME function extra()... Hence welcoming me all over the freaking site...

Am I correct in assuming that the archive, contact and sitemap is in someway categories ? Or possibly just a part of the HOME category... ?

I've come to this by excluding and including this:
Quote
== "" AND get_id('category')
In this snippet:
Quote
<? if (get_id('article') == "" AND get_id('category') == "" AND get_id('archive') <> "contact" AND $_GET['action'] == "") {?>
and I've come up with:

1. If I DO NOT keep it there, the categories function extra() do work, as intended BUT the archive, contact and sitemap shows it aswell.
2. If I DO keep it, the archive, contact and sitemap do NOT show the function extra(), and neither do the regular categories, which have their own extra's attached to them.
(So basiclly this snippet do exactly what I want with the get_id('category') included BUT to show other categories's extra function...)

Problem at hand:

I'll state the facts which I'm daring to achieve but so painfully do fail to:
1. I CAN do following with above code: Make function extra() "disappear" on man made pages , clicking articles, and inside admin when an action is about to be made...(editing mode)
2 I CAN'T, but would like to additionally, achieve this:
Make function extra() "disappear" on clicking archive, contact, site map AND when entering admin area... (that is not only in editing mode - action)

And might I add, I'm as sure as a PHP ignorant can be, of that it is possible by just altering the index.php by a snippet like this, as this have been made before... But I do not trust my life on that assumption.

HELP, PLEASE !!!
« Last Edit: November 22, 2007, 12:25:17 PM by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #1 on: May 08, 2007, 03:10:20 PM »

May be this:
Code: [Select]
<?php if ( (get_id('category') == "") || ( ( get_id('category') == l('home_sef') ) && empty(get_id('article')) ) || !( $_SESSION[db('website').'Logged_In'] == token() ) )  { ?>
<div id="extra_content">
<?php extra(); ?>
</div>
<?php ?>
« Last Edit: November 22, 2007, 12:25:09 PM by Patric Ahlqvist »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #2 on: May 09, 2007, 08:37:47 AM »

Really appriciate your effort guy's, but alas... Neither worked :(

Codetwists, made the index not show at all (fiddled with it some but couldn't make it work)

Bobs, yours did the exact same thing as my own:
Quote
"contact" AND $_GET['action'] == "") {?>
That is show the function extra() only on frontpage, but not on the manmade categories. And not on archive, contact, sitemap...

I have in function pages():
Home, archive, MY OWN PAGE, contact and sitemap (Here the extra should revieal itself only on HOME)
Then I have the normal clicking of articles, and the logged in mode (Here it shouldn't be visible either)

BUT it should be visible in the categories being made through the admin mode... That is my own created categories...

Mhm... will this endevour end well ?
Logged
"It's only dead fish that goes with the flow... "
Updated

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #3 on: May 09, 2007, 09:34:20 AM »

Another one ;)
Code: [Select]
$catSEF = get_id('category');
$artSEF = get_id('article');
if ( !isset($catSEF) || ($catSEF == 'administration') || (check_category($catSEF) === false  && ( !isset($artSEF) || empty($artSEF) ) ) || ($catSEF == s('home_sef') && ( !isset($artSEF) || empty($artSEF) ) )) {
?>

   

Note, that this will not show extra on paginator pages except 1st one and still isn't really handling admin part well.
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #4 on: May 09, 2007, 11:49:46 AM »

have a look here
http://www.solucija.com/forum/viewtopic.php?pid=29211#p29211

Althogh this is a style switcher, it is very specific about when...
Is this the sort of functioning you want with extra??
Logged
Of all the things I have lost, it is my mind that I miss the most.

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #5 on: May 09, 2007, 01:56:38 PM »

@twister:
Whuhaaa... Now we're talking. I'll set it up and try it out, but at a first glance it appears to be really good

@Phil:
We're currently Gtalking... so I will not respond here ;) So you know...
Logged
"It's only dead fish that goes with the flow... "
Updated

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #6 on: May 09, 2007, 11:20:21 PM »

Quote from: philmoz
have a look here
http://www.solucija.com/forum/viewtopic.php?pid=29211#p29211

Althogh this is a style switcher, it is very specific about when...
Is this the sort of functioning you want with extra??
@philmoz : Some idle thoughts for spare time wasting ;)

First one.
How about finding out what is asked just once per display not in each element separately:

1) What about having one function that simple gets all there is to get from get_id() and probably actions as well?
2) And what about such function to return for example small array or something that plainly says - You got 'article' item there (it's sef is this, it's id is that) and probably some other frequently used stuff.
3) And finally what about making it in such a way that almost single call per display will do with all those argument cleanings and basic thing retrievals?

If something comes out of this then probably number of repeating attempts to figure out exactly what kind of 'page' is shown for each 'page' element separately could be reduced ;)

Second one.
What about creating at least function retrieve_array() that allows to return several fields at once and replace current retrieve with wrapper on top of new function to keep old code happy. It's really mindboggling thing to see separate requests in a row smashing away at the same table for different fields. Would beat gargle blaster by magnitude of order if mysql server could find use for such :lol:

Disclaimer. Nothing in this post should be under any circumstances considered as suggestions or opinion; as I said before - just idle thoughts for spare time wasting :D
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #7 on: May 10, 2007, 10:11:01 AM »

Quote from: codetwist
just idle thoughts for spare time wasting :D
spare time??? I just waste time regardless :D :D
Logged
Of all the things I have lost, it is my mind that I miss the most.

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #8 on: May 10, 2007, 10:23:54 AM »

Quote from: codetwist
First one.
How about finding out what is asked just once per display not in each element separately:

1) What about having one function that simple gets all there is to get from get_id() and probably actions as well?
2) And what about such function to return for example small array or something that plainly says - You got 'article' item there (it's sef is this, it's id is that) and probably some other frequently used stuff.
3) And finally what about making it in such a way that almost single call per display will do with all those argument cleanings and basic thing retrievals?

If something comes out of this then probably number of repeating attempts to figure out exactly what kind of 'page' is shown for each 'page' element separately could be reduced ;)

Second one.
What about creating at least function retrieve_array() that allows to return several fields at once and replace current retrieve with wrapper on top of new function to keep old code happy. It's really mindboggling thing to see separate requests in a row smashing away at the same table for different fields. Would beat gargle blaster by magnitude of order if mysql server could find use for such :lol:
so, pull everything (id,sef,title/name) from dbase based on category called, and store in var, and then only interogate that var??
Logged
Of all the things I have lost, it is my mind that I miss the most.

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #9 on: May 10, 2007, 10:32:48 AM »

Basically, yes ;) And additional attribute with values like 'category', like 'article', like 'page', like 'built-in', like 'home' - to provide this distinction clearly; so, no additional checks needed at later reuse.

It's kind of frequently requested info that comes handy in a places over snews.php and a lot of mods as well.
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #10 on: May 10, 2007, 10:34:29 AM »

I've gotten a Philmoz solucija... not posting it here as I thought Phil should post it as a MOD, as he made that solution which is totally great...
Logged
"It's only dead fish that goes with the flow... "
Updated

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #11 on: May 10, 2007, 10:36:54 AM »

Quote from: Patric
I've gotten a Philmoz solucija... not posting it here as I thought Phil should post it as a MOD, as he made that solution which is totally great...
Good ;)
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Excluding function extra() (showing/hiding depending on mouseclicks)
« Reply #12 on: May 10, 2007, 12:35:25 PM »

And so he have... posted the MOD that is:

Go looksie here: http://www.solucija.com/forum/viewtopic.php?pid=29983#p29983
Logged
"It's only dead fish that goes with the flow... "
Updated