21286 Posts in 5733 Topics by 2602 members
| Go to End | ||
| Author | Topic: | 3368 Views |
-
Re: PDF Download link

18 January 2011 at 11:05pm Last edited: 18 January 2011 11:06pm
Uh... that's strange.
I did this in a quick test installation:
Page.phpstatic $has_one = array(
'PDF' => 'File'
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Files", new FileIFrameField('PDF'));return $fields;
}
Template:<div id="PcFile">
<a href="$PDF.Link">$PDF.Title</a>
</div>Everything worked as expected, i was able to upload a .pdf and there was the correct download link showing up on the frontpage (with neat little pdf icon)
So, i am a little bit lost with your problem, sorry.
Maybe some .htaccess issues?Cheers,
Christian -
Re: PDF Download link

19 January 2011 at 12:35am
Hi Invader,
thanks for your efforts!
I left the .htaccess files untouched. So the .htaccess in my assets folder contains:
Deny from all
<FilesMatch "\.(html|htm|xhtml|js|css|bmp|png|gif|jpg|jpeg|ico|pcx|tif|tiff|au|mid|midi|mpa|mp3|ogg|m4a|ra|wma|wav|cda|avi|mpg|mpeg|asf|wmv|m4v|mov|mkv|mp4|swf|flv|ram|rm|doc|docx|txt|rtf|xls|xlsx|pages|ppt|pptx|pps|csv|cab|arj|tar|zip|zipx|sit|sitx|gz|tgz|bz2|ace|arc|pkg|dmg|hqx|jar|xml|pdf)$">
Allow from all
</FilesMatch>This is my top level .htaccess:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><Files web.config>
Order deny,allow
Deny from all
</Files>ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html<IfModule mod_alias.c>
RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule><IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase /RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###I've made good progress in my ss efforts today ... If I get this pdf thing fixed somehow, I will be very happy!
-
Re: PDF Download link

19 January 2011 at 1:02am
Ah, ja...
This is my patched (more info here:http://silverstripe.org/general-questions/show/15505 ) .htaccess file from /assets directory:Deny from all
<FilesMatch "\.(html|htm|xhtml|js|css|bmp|png|gif|jpg|jpeg|ico|pcx|tif|tiff|au|mid|midi|mpa|mp3|ogg|m4a|ra|wma|wav|cda|avi|mpg|mpeg|asf|wmv|m4v|mov|mkv|mp4|swf|flv|ram|rm|doc|docx|txt|rtf|xls|xlsx|pages|ppt|pptx|pps|csv|cab|arj|tar|zip|zipx|sit|sitx|gz|tgz|bz2|ace|arc|pkg|dmg|hqx|jar|xml|pdf)$">
Allow from all
</FilesMatch># We disable PHP via several methods
# Replace the handler with the default plaintext handler
AddHandler default-handler php phtml php3 php4 php5 inc<IfModule mod_php5.c>
# Turn the PHP engine off
php_flag engine off
</IfModule>It's pasted here again.
Replace yours and give it another try
-
Re: PDF Download link

19 January 2011 at 2:56am
Hallo Christian,
und danke...
But that wasn't it. Same error.
The path in the database is fine, there seems to be a problem with instantiation a file object.This snippet from File.php just delivers "/assets".
function Link($action = null) {
return Director::baseURL() . $this->RelativeLink($action);
}function RelativeLink($action = null){
return $this->Filename;
} -
Re: PDF Download link

19 January 2011 at 4:48am
Hey,
something really weird happend. I was just working on my templates when I suddenly recognized a file icon on my detail page. I wanted to find out what the matter was before, checked on special characters etc., but ss has no problems with special characters.
So I have my longed for link, but I can't say what the problem was.
-
Re: PDF Download link

19 January 2011 at 4:56am
Hehe,
M A G I C... or a flushed cache or something.
| 3368 Views | ||
| Go to Top |


