Hi Chris,
What a wonderful creation you have here. I am sure you have received many a just gratitude for this wonderful script and indeed for your other creations and support.
As a newbie, I am hoping to learn a little bit more from working with your script and hopefully able to tweak it a little to achieve what I intended to use it for. On the whole, though, I must say, it already does.
Infact, it has encouraged me to strat learning scripting language /programming as I can realize it's effectual benefits.
I have recently downloaded and installed N13 and testing and tweaking it on my local server before uploading it to the hosting server.
In the interim, I have been able to make some minor adjustments, mainly templating and multiple inclusions in several pages within the website, however, I have come stuck at a problem , I'm sure you will be able to help me with....!
I have the news plugged in using an include code, however, I am attempting to implement a number of options.
I enable friendly urls in the admin management system but when I click on the full story news in the summary, I get a page not found. Am i suppose to be doing something different???
On another implementation, I am attempting to list the article directory or headlines on my index page and have the summary open up on a different page and when the Full Story link is clicked, will then open the full story.
I am sure this can be achieved.
Perhaps you will be kind enough to come to my aid.
I sure will be making a donation as soon as I finish designing this project.
I look forward to hearing from you.
Kindest regards
DMC
I enable friendly urls in the admin management system but when I click on the full story news in the summary, I get a page not found. Am i suppose to be doing something different???
To enable friendly URLs, see the documentation here - http://code.google.com/p/n-13news/wiki/FriendlyURLs
On another implementation, I am attempting to list the article directory or headlines on my index page and have the summary open up on a different page and when the Full Story link is clicked, will then open the full story.
Creating headlines that when clicked open on another page is easy to do, create a new template, call it Headlines
or whatever you want. Edit the News
section of the template and add some code similar to this
<a href="news.php?id={id}">{title}</a><br />
This will show each news article's title only and when clicked, will send the uews to news.php, for news.php, all you need to do is include the system like you normally would
<?php
include 'news/index.php';
?>
Hi Chris,
Thank you for your prompt response to my help request.
I really appreciated it, however, I am still stuck on the same issues I raised. I must be a real dummy or maybe too tired to follow it through.
Firstly, I have followed the tutorial on Friendly URL's and I keep getting errors. Secondly, I was able to implement the redirecting of the news headlines to another page, and I have managed to get it working.
I was making a fundermental mistake. I forgot to identify the particular templates required on each page with the include code. (dooooh)
I will have another attempt ton the FRiendly URL's again as I think I ought to be using that method.
Thanks again and I will be making my donation as soon as this project is completed.
I will also get bak to you with my progress....
Warmest regards
Hi Chris,
Good morning, and hope you're well.
I have a quick question, and I'm hoping you can help me resolve.
I am trying to implement an include code within my news summary page which will enable me to list all the categories, and when clicked, will populate the page with news items under that particular category.
I am sure this is achievable. Perhaps you will be kind enough to help me out.
Warmest regards
This can be achieved by doing the following, navigate to
Options > System > News > Delimiter to separate categories when displaying news
Change that setting to the following
<a href="newpage.php?cat={cat}">{cat}</a>,
Now in your template, place the {categories}
tag where you want the categories to be shown. They will be outputted like this
<a href="newpage.php?cat=Cat1">Cat1</a>, <a href="newpage.php?cat=Cat2">Cat2</a>, ... etc
Now create the page newpage.php
and inside put the following code
<?php
$cat[] = $_GET['cat'];
include 'news/index.php';
?>
This will then show any categories that have been assigned to the category you just clicked on.
Hi Chris, Thanks for your continued support.
I really appreciate it.
I have tried the suggestion you gave me re listing the categories and having them call a list of articles filed under that category.
Un fortunately, it didnt work as I intended it to, suffice to say, I don't thik I'm far off from succeeding. I decided to try a number of possible outcomes by tweaking a few things, bt as I'm a newbie, I guess, I have come unstuck.
Now, here's the idea....
I already have everything working as it should be and even to the point that, I am able to list the headlines on the front page of the website and when clicked, they take you to the individual stories on another page.
I have set it up so that, On the full story page, I have a link to a summary's page or simply, back to the frontpage for the headlines.
what I really want to achieve, is to list the article categories on the full story page so that, say for instance, whilst I am reading a story filed under breaking news, If I clicked on the UK news category on the same page (inserted as an include), it will list all the headline or summary stories filed under that category.
So on the page, I have the full story displayed on the left, and on the right, I will have a listing of all the categories.In this way, I do not have to go back to the front page displaying all the headlines to search for articles filed under UK News...!
I hope I'm making some sense.
Now what is intereting is that, you have 2 suggestion, bothe of them half way to achieveing that, but none, completing the tast.
For instance, the suggestion you gave me, will list the categories of articles already approved, not all of the categories, and also, when you click on any of the headings, it doesn't return anything.
The second option I have been toying around with is this piece of code below:
"<?php requireonce('news/db.php'); requireonce('news/config.php'); $catcounts = DataAccess::fetch("SELECT DISTINCT (SELECT COUNT(storyid) FROM news30groupcats WHERE type = 'news' AND catid = news30cats.id) AS totalposts, name FROM news30cats LEFT JOIN news30groupcats ON news30cats.id = news30groupcats.catid ORDER BY news30_cats.name ASC");
foreach($catcounts AS $c){ echo $c['totalposts'] . " - " . $c['name'] . "<br />"; } ?>"
If there's any way you can reference the output categories to list all the headlines from that particular category when clicked, is exactly what I'm trying to achieve.
I hope this helps and thanks in advance.
Warmest regards
So if I'm understanding this correctly, what you'd like to do is, when a user is viewing a full article, you'd like to show some headlines below that article that are assigned to the same category as the one the user is currently viewing?
You could do that by using a piece of code that grabs the categories the currently article being viewed is assigned to.
<?php
// normal news include here, specify your templates and any other settings you need
include 'news/index.php';
// Grab all categories the current article is assigned to
if(isset($_GET['id'])){
$currentCats = DataAccess::fetch("SELECT " . NEWS_CATS . ".name FROM " . NEWS_GROUPCATS . " LEFT JOIN " . NEWS_CATS . " ON " . NEWS_GROUPCATS . ".catid = " . NEWS_CATS . ".id WHERE storyid = ? AND type = 'news'", $_GET['id']);
$cat = array();
foreach($currentCats AS $c){
// create a new array with only the category names
$cat[] = $c['name'];
}
}
// Now add another news include, the because we've already grabbed all the categories and assigned them to the $cat array
// The system will only display articles assigned to those categories
$template = 'headlines';
include 'news/index.php';
I'm not sure if this is what you need, if it's not let me know I'll see what I can do.
Chris wrote at 2012-02-17 19:09:07
So if I'm understanding this correctly, what you'd like to do is, when a user is viewing a full article, you'd like to show some headlines below that article that are assigned to the same category as the one the user is currently viewing?
You could do that by using a piece of code that grabs the categories the currently article being viewed is assigned to.
<?php
// normal news include here, specify your templates and any other settings you need include 'news/index.php';
// Grab all categories the current article is assigned to if(isset($GET['id'])){ $currentCats = DataAccess::fetch("SELECT " . NEWSCATS . ".name FROM " . NEWSGROUPCATS . " LEFT JOIN " . NEWSCATS . " ON " . NEWSGROUPCATS . ".catid = " . NEWSCATS . ".id WHERE storyid = ? AND type = 'news'", $_GET['id']); $cat = array(); foreach($currentCats AS $c){ // create a new array with only the category names $cat[] = $c['name']; } }
// Now add another news include, the because we've already grabbed all the categories and assigned them to the $cat array // The system will only display articles assigned to those categories $template = 'headlines'; include 'news/index.php';I'm not sure if this is what you need, if it's not let me know I'll see what I can do.
Hi Chris,
Thank you for your reply, hope you're well.
What I really meant was, when a user is viewing a full article, i'd like to show a list of all the categories on the same page so that, when a category is clicked, it will show headlines from only that category? Sorry if I didnt make myself clear earlier. I hope you're able to help. By the way, Thank you once again for your help and support. It is very appreciated
Warmest regards
Well, the system already has the ability to show which categories an article is assigned to using the {categories}
tag in your news template. To make those categories clickable is fairly straight forward. If you navigate to Options
> System
> News
> Delimiter to separate categories when displaying news:
Change it to the following
<a href="newpage.php?cat={cat}">{cat}</a>,
Now when an article displays the categories, each category will be a clickable link that when clicked, sends the user to newpage.php with the category name appended to the url like so http://example.com/newpage.php?cat=TestCat
For newpage.php you can use something like this
<?php
$cat[] = $_GET['cat'];
include 'index.php';
?>
Hi Chris,
Thank you for responding to my query.
Suffice to say, the suggestion you made did output the category info but for some reason, I am not getting the desired output.
Well, the system already has the ability to show which categories an article is assigned to using the
{categories}
tag in your news template. To make those categories clickable is fairly straight forward. If you navigate toOptions
>System
>News
>Delimiter to separate categories when displaying news:
Change it to the following
<a href="newpage.php?cat={cat}">{cat}</a>,
Now when an article displays the categories, each category will be a clickable link that when clicked, sends the user to newpage.php with the category name appended to the url like so
http://example.com/newpage.php?cat=TestCat
For newpage.php you can use something like this
<?php $cat[] = $_GET['cat']; include 'index.php'; ?>
Okay, here I go again.
Say for instance, I have 8 Categories (Which I do). On my include page, I have the news summary on the left column and on the right column is the categories list.
The Categories only shows if there is a news item assigned to it. Also, If a News item is assigned to two Categories, The List shows both categories on the same line and each one of them returns you to the same news item.
Hope I'm making sense.
What I intend to achieve (if it is at all possible) is to have a list of all categories showing on the right column whether it is assigned to a news item or not, and also not to have two Categories assigned to a news item listed on the same line.
The other throwback was also the fact that, say, I had 2 news items under the Category Rumors, the Categories List throws up 2lines on Rumors, each linked to a news item.
Am I making any sense???
So here, I have this include in my left column with 5 news items and 2 assigned to both Rumors and Lifestyle and 2 assigned to just Rumors and the other assigned to Features;
<?php
$nppage = '4';
$template = 'RumorsFrontpage';
$cat[] = 'Rumors';
include './features/editorials/index.php';
?>
<?php
$nppage = '4';
$template = 'LifestyleFrontpage';
$cat[] = 'Lifestyle';
include './features/editorials/index.php';
?>
<?php
$nppage = '4';
$template = 'FeaturesFrontpage';
$cat[] = 'Features';
include './features/editorials/index.php';
?>
For the Categories inclde, I use this;
<?php
$nppage = '10';
$template = 'DisplayCategories';
include './features/editorials/index.php';
?>
The News Items show just as assigned but on the Categories List, this is what I get;
Features
RumorsLifestyle
Rumors
Rumors
Instead of a lsimple list of all the categories ;
Features
Lifestyle
Rumors
with each Category linking to all News items assigned to that particular category. I hope this kinda makes explains it a bit better. Is there something I'm doing wrong or Is it Not Possible?
Thanks for your help in advance.
Warmest regards