Need URL to user file

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Need URL to user file

Postby Musicvid » Sun Oct 28, 2007 5:21 pm

The new "best practices" for RSS http://www.rssboard.org/rss-profile-1#n ... -atom-link say we "should" include an atom link to the generated feed file, in my case the User File(s) for the profile(s) calling my RSS Style and Template.

I'm just scratching the surface, but I assume it would be a sub inside my Style, using some combination of ENV variables plus path information to something like $tmpluserfile($ProfileName). I found some clues in 'sub GetScriptURL' but I am stumped as to how to start. Any ideas?
Last edited by Musicvid on Fri Nov 23, 2007 4:26 pm, edited 2 times in total.
Musicvid
 
Posts: 138
Joined: Wed Jan 17, 2007 1:05 am
Location: Western America

Postby Musicvid » Sat Nov 03, 2007 10:11 pm

There doesn't seem to be a "huge" amount of interest in this, but here is what I'm working on (just going to tweak as I go along):
Code: Select all
<PerlCode>
     use URI;
     use File::Spec;
     my ($userfile, $userfile_path, $feedpath, $rel_path, $feedurl);
#Create the full path to the User File specified in the Profile
     $userfile      = "$newsprofiles{$ProfileName}->{'tmpluserfile'}";
     $userfile_path = "$newsprofiles{$ProfileName}->{'filepath'}";
     $feedpath = ($userfile_path ? $userfile_path : $CConfig{'htmlfile_path'}) . "/$userfile";
#Convert full path to a relative path to cwd
     $rel_path = File::Spec->abs2rel( $feedpath );
#Drop all the ../ and splice with cwd url to make a new url
     $feedurl  = URI->new_abs( $rel_path, $scripturl );
</PerlCode>
Example usage:
<atom:link href="http://ovationplayers.com/news/rss.xml" rel="self" type="application/rss+xml" /> (The url is the output of $feedurl).

This gives the correct output for my $feedurl, but the code is clunky. Anyone been down this trail before (Jackanape?)
Last edited by Musicvid on Tue Nov 06, 2007 3:45 am, edited 24 times in total.
Musicvid
 
Posts: 138
Joined: Wed Jan 17, 2007 1:05 am
Location: Western America

Postby Jackanape » Sun Nov 04, 2007 1:00 pm

I wish I could say I had, Vid...It is a good addition to the library. I watch, myself, with great interest!
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
-Robert A. Heinlein
User avatar
Jackanape
 
Posts: 632
Joined: Tue Jan 09, 2007 12:15 am
Location: Capitol of the Great State of New York

Postby Musicvid » Mon Nov 05, 2007 4:14 am

I watch, myself, with great interest!
Well, it's getting less clunky. I'm editing the above code as I refine it. Ready for prime time soon!
Musicvid
 
Posts: 138
Joined: Wed Jan 17, 2007 1:05 am
Location: Western America


Return to Customization

Who is online

Users browsing this forum: No registered users and 2 guests

cron