UtopiaSoftware Forums

Full Version: [1.1.3-1.2.0] News Categories
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Download: http://www.utopiasoftware.net/newspro/ha...gories.zip

Author: Brian Baker, not me

NOTE: This only theoretically works in versions above 1.1.3. It has not been tested with anything other than 1.1.3 and 1.1.4.

// Thread cheaply imported from the old iB forum
I can't seem to get this thing working
I'm using version 1.2.0
and I did everything as described, but the image doesnt't show up
just look for yourself
http://www.scummi.nl/nije/nieuws.php
in de white square, on the left of every table, that's where the categorie-image should be

can someone please help me out??
Hm. What's the URL to the newspro directory (so I can see news.php directly)?
I'll see if I can ask Brian Baker (the author) what he thinks.
I could be wrong. But {$cat[image]} is only supposed to return the address to the image. So you're going to need to do:

Code:
<img src="{$cat[image]}" />


Inside the news template... I believe... But if {$cat[image]} isn't returning ANYTHING... check to make sure all of the mysql data is correct...



EDIT!!!!

Try using {$cat[imageloc]} I think I may have overlooked that in my debugging... crap

Thank you Brian #2
your explanation didn't make it work completely
but with your help I managed to get it working

I had to add:

Code:
<img src="{$unpurl}{$cat[imageloc]}">


or I just could link my image in te categories-admin to the main map where the image is in

darn, it still didn't work

but, I found the problem and the solution

in both editnews.php and postnews.php you say

Quote:
FIND:
------------------------------------

Code:
<tr>
    <td width="15%"><strong>Subject:</strong></td>
    <td width="85%"><input type="text" size="35" tabindex="1" maxlength="100" name="subject" /></td>
</tr>


------------------------------------
REPLACE WITH:
------------------------------------

Code:
<tr>
    <td width="15%"><strong>Subject:</strong></td>
    <td width="85%"><input type="text" size="35" tabindex="1" maxlength="100" name="subject" /></td>
</tr>

<!-- Categories Hack -->
<tr>
    <td width="15%"><strong>Category:</strong></td>
    <td width="85%"><select name="[b]category[/b]">';
    $getCat = $DB->query("SELECT * FROM `unp_categories`");
    while($cat = $DB->fetch_array($getCat))
    {
        echo '<option value="'.$cat['id'].'">'.$cat['name'].'</option>';
    }
    echo '</select></td>
</tr>
<!-- Categories Hack -->

------------------------------------


the problem is that the name of the variable to set the category is wrong
you say: name="categorie"
but is has to be: name="catid"


so what you have to do in both editnews.php and postnews.php is:

FIND:
------------------------------------

Code:
<tr>
    <td width="15%"><strong>Subject:</strong></td>
    <td width="85%"><input type="text" size="35" tabindex="1" maxlength="100" name="subject" /></td>
</tr>


------------------------------------
REPLACE WITH:
------------------------------------

Code:
<tr>
    <td width="15%"><strong>Subject:</strong></td>
    <td width="85%"><input type="text" size="35" tabindex="1" maxlength="100" name="subject" /></td>
</tr>

<!-- Categories Hack -->
<tr>
    <td width="15%"><strong>Category:</strong></td>
    <td width="85%"><select name="[b]catid[/b]">';
    $getCat = $DB->query("SELECT * FROM `unp_categories`");
    while($cat = $DB->fetch_array($getCat))
    {
        echo '<option value="'.$cat['id'].'">'.$cat['name'].'</option>';
    }
    echo '</select></td>
</tr>
<!-- Categories Hack -->


------------------------------------

Ah yes!

That is only because I forgot to add this to the install file:

Code:
IN POSTNEWS.PHP FIND:
------------------------------------
        $submitnews = $DB->query("INSERT INTO `unp_news` (`date`, `subject`, `news`, `posterid`,`poster`,`catid`) VALUES ('$posttime','$subject','$news','$newsposterid','$newsposter','$catid')");

------------------------------------
ABOVE PLACE:
------------------------------------

        // Category Hack
            $catid = $_POST['category'];
        // Category Hack

------------------------------------


That's why when you changed it to "catid" it already used it as a POST variable... so, either way works.

Hi I was testing out your script and I was wondering if there is a way we can list the news by categories? And if we can alter this hack to add other misc stuff i.e.; mood, what music currently listening or a blank to add your own things?
Pages: 1 2
Reference URL's