EllisLab text mark
Advanced Search
1 of 4
1
   
Plugin: Extract URL Plus
Posted: 09 August 2006 09:56 AM   [ Ignore ]
Avatar
Joined: 2006-03-22
575 posts

This plugin has been rebuilt. Please visit this thread for version 2.

Written solely for the purpose of getting filenames from custom fields populated by the upload form in publish, this plugin can be used to display file type, path, domain, description and many other properties of the URL it finds.

Example usage:

{exp:extract_url_plus show="% filename.% extension (% filesize)"}
    Some text
etc etc
    
<a href="http://www.example.com/directory/myphoto.jpg">My file</a>
    
Some more text?
{/exp:extract_url_plus} 

REMOVE SPACE BETWEEN % AND VARIABLE NAME

This would return:

myphoto.jpg (4.87KB

Available formatting variables to use within the “show” parameter are listed:

% fullurl     - The full url (e.g., “http://www.example.com/directory/myphoto.jpg”)
% protocol     - (e.g., “http” / “https” / “ftp” / “ftps”)
% subdomain     - (e.g., “www”)
% domain         - (e.g., “example”)
% tld         - (e.g., “com”)
% ip           - If the hostname is an IP address, it is available in this variable.
% path         - (e.g., “directory/”)
% filename     - (e.g., “myphoto”)
% extension     - (e.g., “jpg”)
% fullfilename   - (e.g., “myphoto.jpg”)
% hostname     - If an IP address, this will be identical to the &#xip; variable, if not it might contain e.g., “www.ecample.com”
% description   - A brief description of the file, based on extension type. This can be customised in the plugin file if needed
% filesize     - Shows a readable filesize with unit denomination. To use this feature you may need to open the plugin file and edit the line that looks like: var $docpath = ‘/var/www/html/’;

If you are upgrading from an older version:
The plugin will still honour the show parameter with a single variable, without the % sign.

Version 1.3.1

File Attachments
pi.extract_url_plus.zip  (File Size: 4KB - Downloads: 735)
 Signature 

(a.k.a the_butcher)

 
Posted: 15 August 2006 04:14 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-15
12649 posts

Hi there,

Just came across this thread due to your other thread where people were asking for this functionality. Just to say thanks for the plugin but I was reading the documentation by going to the plugins section on my site and it said :

show=“xyz”

I was just wondering what this means? Do I have to place something specific in there for it to work such as the field name?

Thanks for any help with this and thanks for creating the plugin in the first place!

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

 
Posted: 15 August 2006 05:55 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-22
575 posts

Sorry im a bit lame when it comes to documentation! You put in that parameter what you want to show from the matched file, eg.. filename/extension/domain eg.. show=“extension”

 Signature 

(a.k.a the_butcher)

 
Posted: 15 August 2006 05:57 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-15
12649 posts

Hi there,

Don’t worry about the documentation side of things, do that myself a lot as well!! grin

Thanks for the explanation. Terrific little plugin and will definitely find a use for it on upcoming projects.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

 
Posted: 16 August 2006 10:16 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2005-06-13
201 posts

I tried this plugin (to understand what it can)

I wrote:

<b>filename: </b>

{exp:extract_url_plus show="filename"}
http
://www.example.com/files/testing/test.zip
{/exp:extract_url_plus}

<br/><br/> 

according to:

{exp:extract_url_plus show=“xyz”} etc.. {/exp:extract_url_plus}


But I got:

filename: http://www.example.com

Not ‘test’.

 Signature 

tulks.com | SparkFrame CMS v.2

 
Posted: 17 August 2006 04:17 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-22
575 posts

I was wondering when “& # 47 ;” would rear it’s ugly head again.. anyway, problem fixed and i’ve added some more options for the show=”” parameter just for fun.

 Signature 

(a.k.a the_butcher)

 
Posted: 17 August 2006 04:42 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2005-06-13
201 posts

I uploaded your new 1.2 plugin, no other actions, I looked at it in the Plugin Manager only (intalled correctly, 1.2).

The same code (above), a new result:

domain: No URL Found

path: No URL Found

filename: No URL Found

extension: No URL Found

description: No URL Found

 Signature 

tulks.com | SparkFrame CMS v.2

 
Posted: 17 August 2006 05:04 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-22
575 posts

My bad, try it now.

 Signature 

(a.k.a the_butcher)

 
Posted: 17 August 2006 05:20 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Joined: 2005-06-13
201 posts

yes, now absolutely correctly.

Maybe you find a couple of minutes to give 2 examples where it can be used (to activate my fantasy smile )

Thanks a lot.

 Signature 

tulks.com | SparkFrame CMS v.2

 
Posted: 02 October 2006 04:29 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Joined: 2004-10-11
82 posts

Many thanks to the_butcher.  I thought I was going to have to do a hack to achieve and what joy to find you had taken all the pain out of the task.
grin

 
Posted: 01 November 2006 12:47 PM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-26
1664 posts

Can I ask…is there a way to make this extension do a ‘relative’ URL extraction, or a file name with extension?

For example:

{exp:extract_url_plus show="relative"}{img_file}{/exp:extract_url_plus} 

Would output: /images/img.jpg rather than http://www.mysite.com/images/img.jpg. I guess just lopping off the host? This will make this plugin a little friendlier with phpthumb.

Also, what about the full file?

{exp:extract_url_plus show="fullfilename"}{img_file}{/exp:extract_url_plus} 

Would output: img.jpg rather than img. I can work around this using the show=“extension” coupled with show=“filename”, but the code is a little ungainly.

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

 
Posted: 01 November 2006 12:59 PM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-22
575 posts

I’ve thought to myself, previously, that it would be alot more functional to pass the plugin say a “display” parameter with a value such as “path filename” which would then show exactly that, path followed by filename. One day, i will do it!

For now though i will quickly bodge in those two other show values, Give me a second.

 Signature 

(a.k.a the_butcher)

 
Posted: 17 April 2007 12:27 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2006-09-14
23 posts

How do I have this show more than one parameter? Like so:

{exp:extract_url_plus show="filename|extension"}http://www.website.com/images/image.jpg{/exp:extract_url_plus} 

which would give: image.jpg

I cannot seem to get multiple parameters to work. Is this possible? What’s the correct syntax?

 
Posted: 17 April 2007 10:44 AM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-22
575 posts

I have updated, please re-download above.

 Signature 

(a.k.a the_butcher)

 
Posted: 17 April 2007 11:31 AM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2006-09-14
23 posts

the_butcher!

Three cheers to you! Now that is what I call service. Great work!!!!

 
Posted: 15 May 2007 12:25 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-22
575 posts

Updated bug with full stops (.) in file names mucking up the % extension variable.

 Signature 

(a.k.a the_butcher)

 
1 of 4
1