Dynamic Related News

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Postby web » Tue Sep 20, 2005 12:51 pm

Anyway thanks for your try to help.

Let's try to check everything from start point

that's my related.php file's part of code were I've changed the code to variables/ That's all and nothing more is changed.

Code: Select all
$dbuser = 'UserName'; //DB username
$dbpass = 'UserPassword'; //DB pass
$dbhost = 'localhost'; //DB Host
$newstable = 'Table'; //Table where news is stored

//List the fields that you need searched, following the below format.

$searchfield[] = 'Text';
$searchfield[] = 'Subject';

function dbConnect(
$database="Database" //The database where you store Coranto news goes here.
)


Is it right or there is something more i've to change?

and the code im my style

<?php
$search = "<Field: Subject>";
$search = urlencode($search);
include ( 'http://localhost/related.php?s=' . $search);
?>
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Postby bozoka45 » Tue Sep 20, 2005 8:16 pm

You could change the style at the bottom of the page. Thats the style I use on my site, and I left it there as an example of what to do and how news will be output. You mentioned I had fields you didn't, so you might want to make something a little more simple.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby web » Wed Sep 21, 2005 11:43 am

As I don't know anything in php creation couldn't you provide me with the simplest style?
fields I need are

Field: Subject
Build date and time
link may be maginot, through viewnews or direct to a file. Te last is better..

Thank you for help
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Postby web » Wed Sep 21, 2005 8:08 pm

Finally it works. thanks to god and you, my friend

my style looks like
Code: Select all
while($results=mysql_fetch_array($query)) {
   
 if($rcount == '7') {
break;
}

            $relatedHTML .=  "<tr><td><a class='news-item' href=\"../cgi-bin/news/viewnews.cgi?id=" . $results['newsid'] . "&style=print&tmpl=rssview\">" . $results['Subject'] . "</a></td></tr>\n";
            $rcount++;
         }



Now I have two questions:

1. Is there pissibility for DRN to make search by category or by folder

I have categories: news, articles, publications, e.t.c All of them have there folder. I want Related news to be applicable only for one category, let's say "Publications" or if it is not possible - then make search for folder-Publications.


2. tkaplan06 wrote:
The script is printing the current article as one of the related articles, which is a little weird. How can we prevent that?


Your Answer:

You'd have to pass the newsid was one of the GET variables (in the url, like newsid=<Field: newsid>) and in the SQL, add this:

Code:

AND `newsid` != '" . $_GET['newsid'] . "'


Sorry, but it's very difficult to understand.
As I can see you have already applied this to SearchSQL.

Couldn't you provide us with more simpler or clear answer or give the code with all changes made in that will be much better to understand for peop;e knowing nothing in PHP?
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Postby bozoka45 » Wed Sep 21, 2005 11:09 pm

web wrote:Couldn't you provide us with more simpler or clear answer or give the code with all changes made in that will be much better to understand for peop;e knowing nothing in PHP?


This is why I released is as a Customization and not an addon. As I said in my first post:

I'll be happy to provide support for it to a certain extent, but this is more so just a personal mod I'm letting anyone use.


You'll have to use:

Code: Select all
$SearchSQL .= "AND `newsid` != '" . $_GET['newsid'] . "';


or something to that extent.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby web » Thu Sep 22, 2005 8:22 am

ok. My SearchSQl looks like

Code: Select all
$SearchSQL[] = "SELECT * FROM `" . $newstable . "` WHERE `" . $field . "` LIKE '%" . $s . "%' AND `Category`= '" . 'Publications' . "' AND `newsid`!= '" . $_GET['newsid'] . "'";


As you can see it's filtered by category. (that's for above questions)
Now,
Code: Select all
AND `newsid`!= '" . $_GET['newsid'] . "'";


doesn't help. Related.php generates the file with the same id as the main post
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Postby bozoka45 » Thu Sep 22, 2005 9:28 am

You need to pass the newsid variable in the URL.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby web » Thu Sep 22, 2005 2:14 pm

In related.php (I have already it there. see my style) or in Coranto style instead of maginot URL?
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Postby bozoka45 » Thu Sep 22, 2005 7:40 pm

No, in your Coranto style:

Code: Select all
<?php
$search = "<Field: SEARCHFIELD>";
$search = urlencode($search);
include ( 'http://' . $_SERVER['HTTP_HOST'] . '/related.php?s=' . $search  . '&newsid=' . <Field: newsid>);
?>


All you need to add is that last part ( . '&newsid=' . <Field: newsid>)
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby web » Fri Sep 23, 2005 2:51 pm

It helps for some posts. Many of them have the same post. Can't systemize the problem
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Postby Psykosys » Sat Sep 24, 2005 7:04 pm

web wrote:It helps for some posts. Many of them have the same post. Can't systemize the problem

? Please clarify what you're trying to say here. Passing the newsid works for some news items and not others?
Psykosys
 
Posts: 252
Joined: Tue Apr 15, 2003 10:37 pm
Location: Ithaca, NY

Postby web » Sat Sep 24, 2005 8:26 pm

ok. some posts with DRN have itself as related, some of them - not.
User avatar
web
 
Posts: 176
Joined: Sun Nov 30, 2003 3:39 pm

Previous

Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron