21
rowdie
Re: Recent News titles to include topic?
  • 2005/3/9 23:57

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


This was for News 1.2.1. The whole code was posted in post #16 of this thread (at the bottom of the post). It was for the news_top.php file. You shouldn't need line numbers, the whole function has been posted.

Don't use the other code that was posted in this thread. It creates far too many sql queries and could slow down your server if you have a lot of news articles for it to search through.

I haven't looked at the code of News 1.3. so I can't tell you if this will work for that version. You could always try it, and if it doesn't work just upload the original file again. Don't forget to change the template back to the orginal too though (the changes were also explained in post #16)

Good luck

Rowd

22
kavaXtreme
Re: Recent News titles to include topic?
  • 2005/3/10 10:20

  • kavaXtreme

  • Repository Maintainer

  • Posts: 110

  • Since: 2005/1/17


Thanks for taking the time to answer, Rowd. Turns out that about the same time you were posting I was editing my post, so you missed my addition. I think my problem has to do with using 1.3RC2 (a mistake I'm not likely to repeat in the future; final releases only for me from now on).

Here's what I said.
Quote:

My biggest problem is that I can't find the "$sql" thingy where it's supposed to be, so I can't add the topic_title call. I've been trying to get my mind around this, so the rest is beginning to make sense to me.


The $sql calls are in nine files:
ratenews.php
xoopsversion.php
upgrade.php
class.newsstory.php
class.newstopic.php
class.sfiles.php
functions.php (include folder)
notification.inc.php
search.inc.php

Logic rules a few of those out, but I'm still stuck.

For interests sake, here's the start of the b_news_top_show function in the new news_top.php:
function b_news_top_show($options) {
    global 
$xoopsConfig;
    include_once 
XOOPS_ROOT_PATH.'/modules/news/include/functions.php';
    
$myts =& MyTextSanitizer::getInstance();
    
$block = array();
    
$displayname=getmoduleoption('displayname');


    if (
file_exists(XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php')) {
        include_once 
XOOPS_ROOT_PATH.'/modules/news/language/'.$xoopsConfig['language'].'/main.php';
    } else {
        include_once 
XOOPS_ROOT_PATH.'/modules/news/language/english/main.php';
    }

    
$block['displayview']=$options[8];
    
$restricted=getmoduleoption('restrictindex');
    
$dateformat=getmoduleoption('dateformat');
    
$infotips=getmoduleoption('infotips');
    
$newsrating=getmoduleoption('ratenews');

Any thoughts on what to do?

23
kavaXtreme
Re: Recent News titles to include topic?
  • 2005/3/15 10:38

  • kavaXtreme

  • Repository Maintainer

  • Posts: 110

  • Since: 2005/1/17


Okay. News 1.3 Final is officially out. (YES! ) So, can anyone tell me how to apply these 1.2.1 hacks to 1.3? As I mentioned earlier, things seem to have been moved around so I can't figure out what needs to be changed anymore. I'm guessing the changes now need to be made in include/functions.php, but what do I know...

Again, thanks for your previous replies!

24
kavaXtreme
Re: Recent News titles to include topic?
  • 2005/4/8 15:56

  • kavaXtreme

  • Repository Maintainer

  • Posts: 110

  • Since: 2005/1/17


Several PHP tutorials and a lot of hours later, I've figured out how to do it in 1.3. It's actually much easier than in 1.2. In fact, it's so easy the thought of the time I put into figuring it out is nearly enough to make me break down and sob like a child. On the bright side, I can now call myself a beginner in PHP.

So here's what you do:
1. Open news_block_top.html.
2. Locate
<a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>" <{$news.infotips}>><{$news.title}></a> <br /><{$news.teaser}></li>
on line 936.
3. Add
<a href="<{$xoops_url}>/modules/news/index.php?storytopic=<{$news.topicid}>"><{$news.topic_title}></a>:
to the beginning of the line.
4. Click save, and you're good to go.

It's that easy. Just the one file to edit.

I still have a question for those who know a lot more about this than I do. If an article is in a sub-category, this method will display only the subcategory. How do I make it display the parent category first? (i.e. parent category: sub-category: news title)

Login

Who's Online

156 user(s) are online (83 user(s) are browsing Support Forums)


Members: 0


Guests: 156


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits