{filedir_n} not evaluating
Posted: 04 July 2008 01:17 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  12-11-2002

I am trying to use {exp:extract_url} to populate an <a > tag to allow users to download files other users have uploaded into a custom field.

When uploaded, the file winds up in the directory specified by filedir_3 in “Upload Preferences” and my custom field shows: {filedir_3}foo_file.aif

But

<a href="{exp:extract_url}{field_id_19}{/exp:extract_url}">{field_id_19}</a>

results in

<a href="">{filedir_3}foo_file.aif</a>

Is there a trick I am missing?

Profile
 
 
Posted: 04 July 2008 01:23 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

It’s part of the Typography class, so it will only be parsed if if text is being processed through that class. See this plugin for one option. Altertnatively you could simply have a “regular” global variable filedir_#.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 04 July 2008 01:25 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  12-11-2002

So, wrap the exp:extract_url inside exp:typography? Or vice versa?

Profile
 
 
Posted: 04 July 2008 01:28 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Either way should work, might have to experiment with parse=inward. But why not make it a regular global variable? Easiest solution, I’d say, all things considered.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 04 July 2008 01:32 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  12-11-2002

You mean something like

{assign_variable:directory_thingy="public_html/file_uploads"}
<a href="{directory_thingy}/{field_id_19}">{field_id_19}</a>

apologies for the mental slowness
</clueless>

Profile
 
 
Posted: 04 July 2008 01:36 PM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

No, I mean you go into CP > Templates > Global Variables > Create a New Global Variable. Name it filedir_3, or whatever, and use that.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 04 July 2008 01:44 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  12-11-2002

ah, well…

That would work, yes, but:

I am using Leevi G’s SAEF upload extension to allow an SAEF to include a file upload and it needs {filedir_n} to place the file in the right location. It also embeds ‘{filedir_n}’ in the weblog entry custom field, so I seem to be stuck with curly braces.

And EE_Typography seems to wrap things in <p> tags.

Profile
 
 
Posted: 04 July 2008 01:48 PM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

I am not sure I follow. If you do create a gloabl variable, named filedir_3, you can access it anywhere by using {filedir_3}, not only when parsed by the typography class.

If you go the plugin route, just use

{exp:ee_typography formatting="none"}

Moving to Howto.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 04 July 2008 01:51 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  12-11-2002

Yes, formatting=“none” was what I needed, thank you!

To your previous question, the problem with the global variable route is that I am still stuck with ‘{filedir_3}’ in the actual custom field, so you end up with http://www.mysite.com/filedir_3/{file_dir3}filename.ext

Profile
 
 
Posted: 04 July 2008 01:54 PM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

OK, not looking into the extension issue too much at this point, glad you found a working solution.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64914 Total Logged-in Users: 23
Total Topics: 81869 Total Anonymous Users: 20
Total Replies: 440136 Total Guests: 168
Total Posts: 522005    
Members ( View Memberlist )
Newest Members:  smilepolitelyrvmcleodbjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkey