wrinting new function for a content block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   wrinting new function for a content block
jroe
CZ Newbie
jroe has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Oct 05, 2004
0.00 posts per day
Posts: 7
Points: 633
   
hey there. I'm trying to write a block for the content module that displays the pages in the catagory of the page that you are currently viewing. Make sense?

Basically I need to write a function for a content page to deliver it's catagory id. Any advice on how to do this?



Back to top Reply with quote
#2   Re: wrinting new function for a content block
Milne
CZ Active Member
uk.gif
Occupation: Civil Servant/Online Business Owner
Age: 39
Gender: Male
Fav. Sports Team: Manchester United
Website:
Status: Offline
Joined: Oct 24, 2003
0.02 posts per day
Posts: 157
Points: 5,515
 Yahoo Messenger MSN Messenger 


Originally posted by jroe @ Wed Jun 22, 2005 7:26 pm:

hey there. I'm trying to write a block for the content module that displays the pages in the catagory of the page that you are currently viewing. Make sense?

Basically I need to write a function for a content page to deliver it's catagory id. Any advice on how to do this?


How do you mean? Do u mean when a viewer of your site clicks on a link, all the catagories appear below that link?
or
do you mean somethig else?

Milne icon_cool.gif




Back to top Reply with quote
#3   re: wrinting new function for a content block
jroe
CZ Newbie
jroe has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Oct 05, 2004
0.00 posts per day
Posts: 7
Points: 633
   
i don't mean a drop down or anything like that. I mean something like this:

I have catagory A, B, and C

A contains pages 1, 2, 3
B contains pages 4, 5, 6
C contains pages 7, 8, 9

right now I have a block that reads on every content page like this:

A
1
2
3
B
4
5
6
C
7
8
9

But I want the block to detect which catagory it is currently showing and only display the current catagory links.

for example

Let's say the viewer is on page 6. I want the block to read

B
4
5
6


or

A
B
4
5
6
C

and if viewer is on page 8. I want the block to read

C
7
8
9

or

A
B
C
7
8
9

Make sense? The trick is getting the catagory id value on a given page....



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
if the categroy id is in the URL then you can use _GET to retrieve it.


$catid = $_GET['catid'];


Then use it from there.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: wrinting new function for a content block
jroe
CZ Newbie
jroe has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Oct 05, 2004
0.00 posts per day
Posts: 7
Points: 633
   
didn't seem to work. I'm already using $cid, don't know if they conflict, but along the lines of what you suggested, this is something like what it should be like:
$catid = $_GET['catid'];

    if ($cid == $catid) {
    $sql2 = "SELECT pid, title FROM ".$prefix."_pages WHERE active='1' AND cid='$cid' ORDER BY title";
   $result2 = $db->sql_query($sql2);
   while ($row2 = $db->sql_fetchrow($result2)) {
   $pid = intval($row2['pid']);
   $title = stripslashes(check_html($row2['title'], "nohtml"));
   $boxstuff .= "<blockquote><strong><big>·</big></strong>&nbsp;<a href=\"content.html&amp;pa=showpage&amp;pid=$pid\">$title</a></blockquote>";

   }
}


I also tried to set $catid as a global.

If i put a # in place of catid in the if statement, it works...


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum