I hope this doesnt come off as confusing. π³
I have a link in my menu for the Featured Stories on some of my skins. its liked to the "browse.php" since there is not custom page for featured stories.
http://nsync-fiction.com/browse.php?type=featured
Would it be possible to make a custom page for Featured Stories? because I would like to list them but seperate the active from retired... maybe by listing the active ones on top and the retired below them.
could someone help me out? I'm not sure how I would should code it.
thanks π
That would be in browse/featured.php. The difference between the active and retired is that in fanfiction_stories for active featured equals 1 and for retired featured = 2.
This is basically all of browse/featured.php (excluding the license, etc, so stars at line 23).
if(!defined("_CHARSET")) exit( );
$output .= "<div id="pagetitle">".$panel['panel_title']."</div>";
$storyquery .= " AND stories.featured > 0".$storyquery;
$countquery .= " AND featured > 0";
$numrows = search(_STORYQUERY.$storyquery._ORDERBY, _STORYCOUNT.$countquery, "browse.php?");
?>
Playing around, I did this and it seems to do what you're asking.
if(!defined("_CHARSET")) exit( );
$output .= "<div id="pagetitle">".$panel['panel_title']."</div>";
$storyquery .= " AND stories.featured = 1 ".$storyquery;
$countquery .= " AND featured = 1";
$numrows = search(_STORYQUERY.$storyquery._ORDERBY, _STORYCOUNT.$countquery, "browse.php?");
$storyquery2 .= " AND stories.featured > 1 ".$storyquery2;
$countquery2 .= " AND featured > 1";
$numrows = search(_STORYQUERY.$storyquery2._ORDERBY, _STORYCOUNT.$countquery2, "browse.php?");
?>
Keeping in mind this was done on my test site with only two featured stories total and is not thoroughly tested. Also, my PHP/eFic knowledge is not so good, so it's mainly guesswork here... There are probable more elegant ways, but I couldn't think of an easier way to sort that off the top of my head. Maybe it could all be combined into one $numrows, too.
Of course, if you wanted active separate from retired that would take more work, but it could probably be done relatively easily because of the whole
$output .= "<div id="pagetitle">".$panel['panel_title']."</div>";
which should hopefully make it easy enough to separate it, if you named one file like activefeat.php and put the first half of the changed stuff ($storyquery, $countquery, $numrows) and then like retiredfeat.php with the second half ($storyquery2, $countquery2, $numrows) and saved them in the browse folder.
Then it would be yoursite.com/browse.php?type=activefeat and etc.
Theoretically, anyway... haven't tried it.
I was playing around further, and discovered that you can indeed separate these out into two separate files. I'm not sure that's what you originally asked, but the idea sparked when I was looking at this yesterday and I thought I'd follow up.
These both start at line 23, under the license info, etc.
File 1 (either its own, named something like activefeat.php, or modifying the existing featured.php):
if(!defined("_CHARSET")) exit( );
$output .= "<div id="pagetitle">".$panel['panel_title']."</div>";
$storyquery .= " AND stories.featured = 1 ".$storyquery;
$countquery .= " AND featured = 1";
$numrows = search(_STORYQUERY.$storyquery._ORDERBY, _STORYCOUNT.$countquery, "browse.php?");
?>
File 2, named retiredfeat.php or something similar.
if(!defined("_CHARSET")) exit( );
$output .= "<div id="pagetitle">".$panel['panel_title']."</div>";
$storyquery .= " AND stories.featured > 1 ".$storyquery;
$countquery .= " AND featured > 1";
$numrows = search(_STORYQUERY.$storyquery._ORDERBY, _STORYCOUNT.$countquery, "browse.php?");
?>
Save these files to the /browse/ folder.
Then, you have to create panels for them so the script can actually use them.
For the 'active' one, input something like this if you made a new file:
Name: activefeat <--- This is what is appended to the URL and how it's named in the database.
Title: Current Featured Stories <--- How it appears to users on the site.
URL to Panel: browse.php?type=activefeat <--- I think this is meant to match the 'name' entry.
Level: 0 <--- So all visitors can see. 1 for logged in only.
Hidden: Yes
Type: B <--- For browse.
*If you modified the existing featured.php, then you don't have to do anything in this step.
For the 'retired' one, create a new panel entry with info similar to this:
Name: retiredfeat
Title: Retired Featured Stories
URL to Panel: browse.php?type=retiredfeat
Level: 0
Hidden: Yes
Type: B
Note: If you want these to appear when people click the "Browse" link in the menu bar, then simply uncheck the "hidden" option for both.
You can see this in action at my test site: http://efictiontest.verilyviridian.com/browse.php where I have un-hidden them, so they appear on the browse options list.
thank you! thank you! thank you!
I did mean what you did the first time... having them listed on the same page.
but after viewing your test site and how it looks as two separate pages ... I liked that SO much better! π
I just finished setting it up and everything looks/works great! thanks again!
Glad I could help!
A couple of thoughts that have struck.
1) If you want to add them to menu block, I think you first have to add them as new page links, and then add them to menu block. Relevant wiki entries.
Adding page links: https://efiction.org/wiki/index.php5?title=Adding_custom_links
Modifying your site's menu: https://efiction.org/wiki/index.php5?title=How_to_change_the_site_menu
2) What is good about this (assuming you made two new files, instead of one new file and modifying featured.php) is that for the next upgrade, you won't have to redo the mod, because the files aren't part of the standard upgrade and won't be overwritten. Of course, you should double-check in the next version that browse/featured.php isn't changed. But if it is, the modifications are very close to the original (only 4 characters changed apiece), so it shouldn't be too hard to redo them.
