Post Reply  Post Thread 
Pages (2): « First [1] 2 Next > Last »
Only category in news
Author Message
holas
Junior Member
**


Posts: 4
Group: Registered
Joined: Sep 2007
Status: Offline
Reputation: 0
Post: #1
Only category in news

It's possible to show only category in my news?, how?. For example, I would like to show one category (for example car) in my page car.php, category trucks in my page trucks.php, etc. Thank you.

09-20-2007 04:28 AM
Find all posts by this user Quote this message in a reply
Brian
Administrator
*******


Posts: 122
Group: Administrators
Joined: Jan 2006
Status: Offline
Reputation: 0
Post: #2
RE: Only category in news

This is possible. You would need to make copies of news.php, and call them news-cars.php, news-trucks.php, etc, and simply modify the queries. If you want me to be more specific, tell me what categories you have and what the category ID of each one is.

To tell what the ID for a category is, hover over the links next to it in the categories page and note the number at the end of the URL.


Brian Earley
Utopia Software
utopiasupport@gmail.com
http://www.utopiasoftware.net
Software: Utopia News Pro
09-24-2007 11:51 AM
Visit this user's website Find all posts by this user Quote this message in a reply
holas
Junior Member
**


Posts: 4
Group: Registered
Joined: Sep 2007
Status: Offline
Reputation: 0
Post: #3
RE: Only category in news

Brian Wrote:
This is possible. You would need to make copies of news.php, and call them news-cars.php, news-trucks.php, etc, and simply modify the queries. If you want me to be more specific, tell me what categories you have and what the category ID of each one is.

To tell what the ID for a category is, hover over the links next to it in the categories page and note the number at the end of the URL.

In my news I have many categories. ¿It's possible to add any code in my news.php (for example, news.php?car, news.php?truck) to show that category that I want?. Thank you.

09-25-2007 04:18 AM
Find all posts by this user Quote this message in a reply
Brian
Administrator
*******


Posts: 122
Group: Administrators
Joined: Jan 2006
Status: Offline
Reputation: 0
Post: #4
RE: Only category in news

It is possible, though the way page-including in general works, it will only be effective with PHP includes or iframes.

Anyway, in news.php, you could find:

PHP Code:
isset($_GET['action']) ? $action $_GET['action'] : $action ''

And add below it:

PHP Code:
if (!isset($urlGetCat))
{
isset(
$_GET['category']) ? $urlGetCat $_GET['category'] : $urlGetCat '';


And then in news.php

Find:

PHP Code:
$getnews $DB->query("SELECT * FROM `unp_news` ORDER BY `date` DESC LIMIT $newslimit"); 


Replace with:

PHP Code:
$getnews $DB->query("SELECT * FROM `unp_news` WHERE `catid`='$urlGetCat' ORDER BY `date` DESC LIMIT $newslimit"); 


Now, if you are using frames, just include news.php?category=categorynumber, replacing categorynumber for each instance. If you are using PHP includes, link to your page as normal and add ?category=categorynumber to the link.

Let me know if anything is unclear.


Brian Earley
Utopia Software
utopiasupport@gmail.com
http://www.utopiasoftware.net
Software: Utopia News Pro

This post was last modified: 09-28-2007 12:58 PM by Brian.

09-26-2007 05:07 AM
Visit this user's website Find all posts by this user Quote this message in a reply
holas
Junior Member
**


Posts: 4
Group: Registered
Joined: Sep 2007
Status: Offline
Reputation: 0
Post: #5
RE: Only category in news

Brian Wrote:
It is possible, though the way page-including in general works, it will only be effective with PHP includes or iframes.

Anyway, in news.php, you could find:

PHP Code:
isset($_GET['action']) ? $action $_GET['action'] : $action ''

And add below it:

PHP Code:
if (!isset($urlGetCat))
{
isset(
$_GET['category']) ? $urlGetCat $_GET['category'] : $urlGetCat '';


And then in news.php

Find:

PHP Code:
$getnews $DB->query("SELECT * FROM `unp_news` ORDER BY `date` DESC LIMIT $newslimit"); 


Replace with:

PHP Code:
$getnews $DB->query("SELECT * FROM `unp_news` WHERE `catid`='$urlGetCat'[/B] ORDER BY `date` DESC LIMIT $newslimit"); 


Now, if you are using frames, just include news.php?category=categorynumber, replacing categorynumber for each instance. If you are using PHP includes, link to your page as normal and add ?category=categorynumber to the link.

Let me know if anything is unclear.


I have this error (I have intalled News Illustrated)

Code:
Database error in Utopia News Pro:

Invalid SQL Query: SELECT * FROM `unp_news` WHERE `catid`=''[/B] ORDER BY `date` DESC LIMIT 10
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[/B] ORDER BY `date` DESC LIMIT 10' at line 1

MySQL Error Number: 1064

Date: September 27, 2007 12:27 PM
Script: /

This post was last modified: 09-27-2007 08:36 PM by holas.

09-27-2007 08:30 PM
Find all posts by this user Quote this message in a reply
Brian
Administrator
*******


Posts: 122
Group: Administrators
Joined: Jan 2006
Status: Offline
Reputation: 0
Post: #6
RE: Only category in news

Recopy the last line of code I gave and try again. There was a typo in it.


Brian Earley
Utopia Software
utopiasupport@gmail.com
http://www.utopiasoftware.net
Software: Utopia News Pro
09-28-2007 12:58 PM
Visit this user's website Find all posts by this user Quote this message in a reply
holas
Junior Member
**


Posts: 4
Group: Registered
Joined: Sep 2007
Status: Offline
Reputation: 0
Post: #7
RE: Only category in news

It doesn't work. Not show anything. Thank you.

09-28-2007 05:45 PM
Find all posts by this user Quote this message in a reply
Brian
Administrator
*******


Posts: 122
Group: Administrators
Joined: Jan 2006
Status: Offline
Reputation: 0
Post: #8
RE: Only category in news

Can you give me a link to the page your news is being displayed on, and tell me the URL to NewsPro itself? I think all the code is in place to make this work now, and it's just a question of implementation.


Brian Earley
Utopia Software
utopiasupport@gmail.com
http://www.utopiasoftware.net
Software: Utopia News Pro
09-29-2007 12:57 AM
Visit this user's website Find all posts by this user Quote this message in a reply
alex11sf
Junior Member
**


Posts: 7
Group: Registered
Joined: Dec 2007
Status: Offline
Reputation: 0
Post: #9
RE: Only category in news

Brian, You are super. Thanks very much. I edited my script for the categories and it worked!!!

12-17-2007 04:35 AM
Find all posts by this user Quote this message in a reply
Brian
Administrator
*******


Posts: 122
Group: Administrators
Joined: Jan 2006
Status: Offline
Reputation: 0
Post: #10
RE: Only category in news

That's great to hear. Smile


Brian Earley
Utopia Software
utopiasupport@gmail.com
http://www.utopiasoftware.net
Software: Utopia News Pro
12-17-2007 04:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Pages (2): « First [1] 2 Next > Last »
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: