This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Downloads and custom fields on the first page


avatar
cosmin 269
From: -
Downloads and custom fields on the first page

Hi. Philipp. I have a problem. I would like to have something like this on the frontpage:

Program title + version(custom field)

Description ->pulled from download description

Permalink to the program.

Kinda like the news imported from the queue, but for downloads. Right now I first import the downloads from the queue, and then import my own downloads rss feed as news, which is clumsy as hell, creates a lot of problems because of the changing version field and because the RSS still creates old style links like http://www.file-portal.net/download.php?det=509).

Could you whip up a mod for me?

You can see what I'm trying to achieve on my frontpage : www,file-portal.net

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

This is the wrong position. The section in question is at line 295-301.
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

My index.php extracted from the 1.8.2 zip archive doesn't seem to have

if ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$mainnews .= GetTemplate("news_col_footer");
}
$mainnews .= GetTemplate("news_subfooter");
}

anymore.
It actually has

if ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$mainnews .= GetTemplate("news_col_footer");
}

trying to replace the second snippet either complains about an extra curly bracket or prevents index.php from loading
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

Doesn't work. I tried bumping a file, the heading now says Oct 7 but nothing appears under it. I'm not using caching, I don't have such high traffic.
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

First, change "Sort main news by day?" to "Yes".

Then try adding a new file. Does this file appear on the frontpage? You may need to clear the news cache.
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

NEWS
Configure here the news on the front page
--------------------------------------------------------------------------------

Sort main news by day? No doesn't display anything yes displays just the day but no news for the day in question
Max. Days: 7
Max. News: 25
Two news columns? no
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

Philipp, the mod I requested at the beginning of this thread no longer works with version 1.8.2 I tried replacing the code sections you mentioned and index.php no longer works correctly.

The code should work. Did you set the number of displayed days under Website => Edit => News?

And I would like for programs on the frontpage to be displayed like here
 http://www.downloadpipe.com/
that means displaying several of the extra fields.
with a link to the screenshot, etc

You could use the extra fields (Downloads => Edit Fields) for additional data and then add it to the template by adding $insert[download_extra1] (for field #1) - $insert[download_extra20] (for field #20)
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

Philipp, the mod I requested at the beginning of this thread no longer works with version 1.8.2 I tried replacing the code sections you mentioned and index.php no longer works correctly. The downloads for the day are no longer displayed, as you can see on the frontpage of www.file-portal.net
And I would like for programs on the frontpage to be displayed like here
 http://www.downloadpipe.com/
that means displaying several of the extra fields.
with a link to the screenshot, etc
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

I assume the caching system is enabled? Adding a download will not automatically delete the news cache. Try to delete the news cache manually by clicking "Clear Cache" in the News menu.

If this work, you can apply the following small modification in cadmin/mod_download.php to automatically delete the news cache. Find the following code in function DownloadAdd ():

        RemoveCache ("download/download");

RemoveCache ("xml/xmlnews-120");
RemoveCache ("xml/xmlhelp");

and add:

    RemoveCache ("news/mainnews");

This should delete the mainnews (front page) cache each time you are adding a new download
1 Re: Downloads and custom fields on the first page
avatar
0
From: -
Downloads and custom fields on the first page

Sure no problem:

First Section
if ($blocks[website_mainnews])
{
$story_date_array = array();

//Makes the downloads show up on the index page
$result = DBQuery("SELECT DISTINCT SUBSTRING_INDEX(download_time,' ','1') FROM esselbach_st_downloads ORDER BY download_time DESC LIMIT $blocks[website_daymax]");

//This was commented out so that we can list the downloads on the index page instead of the "news" section that's default
//$result = DBQuery("SELECT DISTINCT SUBSTRING_INDEX(story_time,' ','1') FROM esselbach_st_stories WHERE story_main = '1' AND story_website = '$website' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') OR story_main = '1' AND story_website = '0' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC LIMIT $blocks[website_daymax]");

while (list($story_time) = mysql_fetch_row ($result))
{
array_push ($story_date_array, "$story_time");
}
}


Second Section
//added for downloads on index page
if ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$mainnews .= GetTemplate("news_col_footer");
}

//download -- start
$result = DBQuery("SELECT * FROM esselbach_st_downloads WHERE (download_time LIKE '%$story_date_array[$a]%') ORDER BY download_time DESC");
while ($insert = mysql_fetch_array($result))
{
$insert[story_title] = $insert[download_title]." ".$insert[download_extra1]; // Replace download_extra1 with version field
$insert[story_text] = DeChomp($insert[download_text]);
$insert[story_time] = $insert[download_time];
$insert[story_author] = $insert[download_author];
$insert[story_text] .= "<br /><br /><a href=download.php?det=$insert[download_id]>Read more</a>";
$mainnews .= GetTemplate("news");
}
//download -- end

$mainnews .= GetTemplate("news_subfooter");
}
//Removed for downloads on index page
// if ($newsrow == 1)
//{
//$mainnews .= GetTemplate("news_col_middle");
// $mainnews .= GetTemplate("news_col_footer");
//}
//$mainnews .= GetTemplate("news_subfooter");
//}
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

That's odd. Can you post the entire code section that you have changed?
1 Re: Downloads and custom fields on the first page
avatar
0
From: -
Downloads and custom fields on the first page

Sort news by day is enabled
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

Is "Sort main news by day?" (under Other => Websites = Edit) enabled?
1 Re: Downloads and custom fields on the first page
avatar
0
From: -
Downloads and custom fields on the first page

No there's no error message. The front page just stays the same, like I never even made the changes to the index.php as you described. I enter a new download and hit submit, and it does update the downloads section but not the index. Is there another step to get it to update the main page that I'm missing?
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

My question for you is what do you mean by "You need to replace download_extra1 with your custom version field?"

He was using a custom field for the version number. Storyteller's download module supports up to 20 custom fields (download_extra1 - download_extra20)

I've done everything you said up to this point and can't get anything to work for me.

Is there an error message?
1 Re: Downloads and custom fields on the first page
avatar
0
From: -
Downloads and custom fields on the first page

Philipp I'm looking to do this exact thing myself. My question for you is what do you mean by "You need to replace download_extra1 with your custom version field?" I've done everything you said up to this point and can't get anything to work for me.

Thanks for your help
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

Replace:

$insert[story_text] .= "<br /><br /><a href=download.php?det=$insert[download_id]>Read more</a>"; 

with:

$stitle = str_replace(" ","-",$insert[download_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitled = $stitle."_d".$insert[download_id].".html";
$insert[story_text] .= "<br /><br /><a href=$stitled>Read more</a>";


The XML feed modification requires a change in backend.php.

Find:

$insert[story_link] = "$configs[6]/download.php?det=$insert[download_id]";

and replace with:

$stitle = str_replace(" ","-",$insert[download_title]); 

$stitle = str_replace("?","",$stitle);
$stitle = htmlentities($stitle);
$stitled = $stitle."_d".$insert[download_id].".html";
$insert[story_link] = "$configs[6]/$stitled";


I never done the categories, but I will look into it later.
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

First of all thank you for your support. Yes they work indeed. But in some places there still are no SE friendly URLs. On the frontpage and in the XML feeds the URLs still look like this:
http://www.file-portal.net/download.php?det=555


Is there any way to make them SE friendly with title and all?



$insert[story_text] .= "<br /><br /><a href=download.php?det=$insert[download_id]>Read more</a>";



Same question for categories. If I go here  http://www.file-portal.net/download.php

I get  http://www.file-portal.net/download1.html not  http://www.file-portal.net/antivirus.html

Appreciate your help as always.
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

Both should work, but you need to add a download before a new day show up.
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

Works like a charm. But I can no longer import news now. Can't have it both ways, huh? Any chance I cand do both?
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

Here a try. Open index.php in an editor and find:

$result = DBQuery("SELECT DISTINCT SUBSTRING_INDEX(story_time,' ','1') FROM esselbach_st_stories WHERE story_main = '1' AND story_website = '$website' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') OR story_main = '1' AND story_website = '0' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC LIMIT $blocks[website_daymax]");

Replace this line with:

$result = DBQuery("SELECT DISTINCT SUBSTRING_INDEX(download_time,' ','1') FROM esselbach_st_downloads ORDER BY download_time DESC LIMIT $blocks[website_daymax]");

Replace:

                if ($newsrow == 1)

{
$mainnews .= GetTemplate("news_col_middle");
$mainnews .= GetTemplate("news_col_footer");
}
$mainnews .= GetTemplate("news_subfooter");
}

with:

                if ($newsrow == 1)

{
$mainnews .= GetTemplate("news_col_middle");
$mainnews .= GetTemplate("news_col_footer");
}

//download -- start
$result = DBQuery("SELECT * FROM esselbach_st_downloads WHERE (download_time LIKE '%$story_date_array[$a]%') ORDER BY download_time DESC");
while ($insert = mysql_fetch_array($result))
{
$insert[story_title] = $insert[download_title]." ".$insert[download_extra1]; // Replace download_extra1 with version field
$insert[story_text] = DeChomp($insert[download_text]);
$insert[story_time] = $insert[download_time];
$insert[story_author] = $insert[download_author];
$insert[story_text] .= "<br /><br /><a href=download.php?det=$insert[download_id]>Read more</a>";
$mainnews .= GetTemplate("news");
}
//download -- end

$mainnews .= GetTemplate("news_subfooter");
}


You need to replace download_extra1 with your custom version field.

What it does:
This modification get the latest downloads for each day and print it as news on the main page.

Let me know if you have any questions
1 Re: Downloads and custom fields on the first page
avatar
OP 269
From: -
Downloads and custom fields on the first page

I don't really know. What I really need is being able to add downloads on the first page directly as they arrive, instead of importing them into news first, which leads to naming inconsistencies (link to older file version being broken or pointing to newer version, etc) In other words import content from the downloads queue instead of news.
1 Re: Downloads and custom fields on the first page
avatar
Administrator
1340
From: Vienna, Austria
Downloads and custom fields on the first page

This is a larger modification. Do you need this for the main page and the archive pages?

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.