XFileSharing Pro - Different download pages

Message
Author
johntrader
Posts: 17
Joined: May 17, 2011 3:04 am

Different download pages

#1 Postby johntrader » Aug 18, 2011 2:14 am

Hello,

Is it possible to have 2 different download pages and displaying these download pages depending on the file extension ?

So if it's a video being uploaded it will show a video with ads and a choice to download it

and

If it's a rar being uploaded it will display a page where it will ask the user to buy premium / continue in 60 seconds.

Would it be possible to do this ?

Belgin Fish
Posts: 101
Joined: Aug 09, 2010 6:30 pm

#2 Postby Belgin Fish » Aug 18, 2011 4:12 am

I believe the easiest way to do this would be to simply add the

<TMPL_IF video_code>

code to check if it's a video, and then do the video page stuff, and have an else and then the regular download page stuff.

You'd do this in cgi-bin/templates/download2.html

johntrader
Posts: 17
Joined: May 17, 2011 3:04 am

#3 Postby johntrader » Aug 18, 2011 3:21 pm

Belgin Fish wrote:I believe the easiest way to do this would be to simply add the

<TMPL_IF video_code>

code to check if it's a video, and then do the video page stuff, and have an else and then the regular download page stuff.

You'd do this in cgi-bin/templates/download2.html
Would this also be possible with mp3 files ?

Belgin Fish
Posts: 101
Joined: Aug 09, 2010 6:30 pm

#4 Postby Belgin Fish » Aug 18, 2011 8:09 pm

<TMPL_IF song_url>


should do the trick, although that's for download1 so if it doesn't work you may have to change up some of the perl code to load that var.

Belgin Fish
Posts: 101
Joined: Aug 09, 2010 6:30 pm

#5 Postby Belgin Fish » Aug 19, 2011 12:43 am

I just double checked and that code should work just fine for the mp3s on download2 :)

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#6 Postby PilgrimX182 » Aug 21, 2011 8:50 am

Here goes special free quick hack:
in index_dl.pm find line

Code: Select all

   return $ses->PrintTemplate("download1.html",
and replace it with

Code: Select all

my $tmpl1="download1_video.html"
 if $file->{file_name}=~/\.(avi|divx|mkv|flv|mp4|wmv)$/i;
$tmpl1||="download1.html";
   return $ses->PrintTemplate($tmpl1,
then create download1_video.html template. It will be used for files with avi|divx|mkv|flv|mp4|wmv extensions.

Don't forget to backup current index_dl.pm!

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#7 Postby Jesse202 » Aug 21, 2011 4:18 pm

thanks. might use this one day

johntrader
Posts: 17
Joined: May 17, 2011 3:04 am

#8 Postby johntrader » Aug 23, 2011 1:15 am

Thanks for the replies everyone. What I would like to do is a little more complicated then a simple template change. I do not want free users who download mp3's to wait but I DO want the people that download any other file type to wait or get premium. Would this be possible ?

johntrader
Posts: 17
Joined: May 17, 2011 3:04 am

#9 Postby johntrader » Aug 28, 2011 3:55 am

bump

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#10 Postby PowerChaos » Sep 09, 2011 2:28 pm

you can edit the code here on this place
not sure what code you need to place but if you mess a little around then you can get it to work

Code: Select all

   &Download2('no_checks') if  $premium &&
                               !$c->{captcha} &&
                               !$c->{download_countdown} &&
                               !$file->{file_password} &&
                               $ses->getUser->{usr_direct_downloads};

   $file = &DownloadChecks($file);

   my %secure = $ses->SecSave( $file->{file_id}, $c->{download_countdown} );
find this line in index.pm

hopely this can help a bit

Greetings From PowerChaos