Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: 'Posted in' or 'Filed under' type mod not working  (Read 910 times)

pearjam

  • Full Member
  • ***
  • Karma: 14
  • Posts: 152
'Posted in' or 'Filed under' type mod not working
« on: February 05, 2011, 05:59:33 pm »


Hi all!

I'm trying to add the category an article's posted in, next to it's date etc in the infoline.

I didn't find a mod here, but found directions to mdj's site. I'm having a hard time getting it to work from the comments on that site. I understand I have to echo $r['name'] to get the category, but the article query(s) need to be adapted to.

My article queries are tangled from other mods, so I can't tell if that's effecting it, or what I need to add to the query....

So, here's the question - if I echo $r['name'] next to date, what snips must be in the queries for it to work? I want to check my queries against what must be there for the "echo $r['name']" to work.

For instance some one might say:
'To get the value of echo $r['name'], you must have "a.category AS acat" and "c.name AS name" in the queries.'

...then I could just make sure those are in there (vs pasting the entire query). Any help's appreciated.

Logged
....I must go, for I am their leader - and they have gone.

jesth

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 66
Re: 'Posted in' or 'Filed under' type mod not working
« Reply #1 on: February 05, 2011, 06:36:54 pm »

Logged

pearjam

  • Full Member
  • ***
  • Karma: 14
  • Posts: 152
Re: 'Posted in' or 'Filed under' type mod not working
« Reply #2 on: February 05, 2011, 08:29:38 pm »


I've looked at both:
http://snewscms.com/forum/index.php?topic=8578.0
..and:
http://snewscms.com/forum/index.php?topic=8445.0

So all I have to use is:
Quote
You could use:
echo '<div class="post_cat" title="category"><i>'.$link.$uri.'/">'.$r['name'].'</a></i></div>';
and put it where you want it.

...and I don't need to add anything to the queries?

I believe something has to be added to the query for it to know the value of $r['name'] - what needs to be added to the query?

For instance some one might say - "You must have "a.category AS acat" and "c.name AS name" in the queries to get the value of $r['name']."

...then I could just make sure those are in there (vs pasting the entire query because mine's already moded).


« Last Edit: February 05, 2011, 08:36:42 pm by pearjam »
Logged
....I must go, for I am their leader - and they have gone.

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: 'Posted in' or 'Filed under' type mod not working
« Reply #3 on: February 05, 2011, 08:49:11 pm »

c.name AS name
try this one
Logged
Of all the things I have lost, it is my mind that I miss the most.

pearjam

  • Full Member
  • ***
  • Karma: 14
  • Posts: 152
Re: 'Posted in' or 'Filed under' type mod not working
« Reply #4 on: February 06, 2011, 07:10:40 am »

Well, let's see if I can explain this...

In the first url I posted:
http://snewscms.com/forum/index.php?topic=8578.0
I couldn't use:
Code: [Select]
echo '<div class="post_cat" title="category"><i>'.$link.$uri.'/">'.$r['name'].'</a></i></div>';..because I couldn't find any code that looked like that - I found the code that does all that, but it doesn't look any thing like it.

In the second url I posted:
http://snewscms.com/forum/index.php?topic=8445.0
I was 'carefully going over comments #5 - 9' as examples. Comment 9 details a fix for the category names not being selected in the queries.

So this is what happened...

"Filed under" is on my to-do list, so I came to the forums, searched for "filed under", and grabbed 2 threads whose titles, questions and version matched what I was looking for.

BOTH of them had code or pointed to code - that was in use for an entirely different mod all together, something called "pretty dates".

BUT neither of the threads mention "pretty dates" - so I assumed the solutions being given were for 'filed under' (what I searched for) - not 'how to add filed under to your pretty dates'.

I figured something was off, so I searched for other threads but the two I found had questions that nailed it.

I assumed my code was different because of mods I've done, so I thought if I knew what $r['name'] needed, I could make sure it was being pulled, and rule that out.

Everything plus the kitchen sink is being pulled in the query and I couldn't figure out what could be missing. I finally had to post my own thread. I saw Philmoz's reply, but "c.name AS name" was already in the query.

I decided I was going to build from $r['name'] up. Here's what I came up with:

Code: [Select]
echo '<div class="fixme">Filed under: <a href="'._SITE.$link.$uri.'/">'.$r['name'].'</a>';
It works, it's a link, and that's what I was needing.

...So that's how I came to have my "Filed under", but without the pretty dates.   ;)



« Last Edit: February 06, 2011, 07:19:04 am by pearjam »
Logged
....I must go, for I am their leader - and they have gone.