Kevin,

Just a note, that I did not forget this suggestion. I really like it and
will introduce it into BoltWire next chance I get. The next release for
sure.

Cheers,
Dan


P.S. Here's my current code if you want to test it. It is from markups.php.
It also fixes a glitch where the forward slashes are converted to dots in
the link display. I'm commenting out the tags feature because it is easier
now to use an info page for tagging...

function BOLTMlinks($x) {
## FAIRLY COMPLEX MARKUP RULE HANDLING LINKS. MORE DOCUMENTATION NEEDED.
global $scriptURL, $fieldURL, $cleanURL, $pageLink, $BOLTmissingMark,
$BOLTlinkJs;
$x = BOLTstripSlashes($x);
if ($BOLTmissingMark == '') $BOLTmissingMark = "<span
class='marks'><sup>?</sup></span>";
if (BOLTconfig('missingMark', 'true') == 'true') $missing =
$BOLTmissingMark;
if (substr($x, 0, 1) == '?') {
$x = substr($x, 1);
$missing = '';
}
if (substr($x, 0, 1) == '#') {
list($link,$label) = explode('|',$x,2);
$link = substr($link, 1);
if ($label == '+') {
if ($link == BOLTutf2url($link)) $label = ucfirst($link);
else $label = $link;
}
$link = BOLTutf2url($link);
return BOLTescape("<a name='$link'>$label</a>");
}
list($link,$label,$attrs) = explode('|',$x,3);
$link = trim($link);
$label = trim($label);
if (substr($link, 0, 1) == '~') {
$link = 'member.' . trim(substr($link, 1));
if ($label == '') $label = BOLTvars("member.$link:member");
}
if (substr($link, 0, 1) == '/') {
$link = $fieldURL . $link;
}
// if (substr($link, 0, 4) == 'tag.') {
// if (BOLTconfig('tags') == 'true') return;
// }
if ($label == '') {
if (BOLTconfig('linkTitles') == 'true') $label = '+';
else $label = $link;
}
$attrs = trim($attrs);
$args = BOLTargs($attrs, 'links');
if (is_array($args)) {
foreach($args as $f => $v) {
if (! in_array($f, BOLTattrs('a'))) continue;
$attr .= " $f=\"" . $v . "\" ";
}
}
$attr = str_replace('xmllang', 'xml:lang', $attr);
if (isset($args['js'])) $attr = " " . $BOLTlinkJs[$args['js']] . " $attr" ;
if (strtolower(substr($link, 0, 3)) == "www") {
if ($link != strtolower($x) && $label == $x) $label = $link;
$link = "http://$link";;
}
if (strpos($link, '://') == false) {
if (strpos($link, '@')) $link = "mailto:$link";;
else {
$link = BOLTpageshortcuts($link);
if (!preg_match('/^[-_a-zA-Z0-9~\.%]+(\#|\&|$)/', $link)) return
BOLTtranslate(BOLTinfoVar('site.messages', 'invalid_link', 'Invalid
link.'));
if (! BOLTexists($link) && strpos($link, '&') === false) $missingPage =
$missing;
if ($label == '+') {
if (strpos($link, '&') !== false) $label = BOLTvars(substr($link, 0,
strpos($link, '&')) . ':title');
elseif (strpos($link, '#') !== false) $label = ucfirst(substr($link,
strpos($link, '#') + 1));
else $label = BOLTvars("$link:title");
}
else $label = BOLTpageshortcuts($label);
if (isset($cleanURL)) $link = $cleanURL . str_replace('.', '/', $link);
else $link = $scriptURL . $link;
}
if ($attr == '') $defaultAttr =  BOLTconfig('linkIntAttr', '');
}
else {
if ($attr == '') $defaultAttr =  BOLTconfig('linkExtAttr', "
rel='nofollow'");
if ($label == '+' || $label == $link) $label = BOLTescape($link);
}
if ($label == '=') $label = $link;
$label = BOLTurl2utf($label);
$link = str_replace('&', '&amp;', $link);
if (function_exists('myBOLTMlinks')) return myBOLTMlinks($link,
$defaultAttr, $attr, $label, $missingPage);
return BOLTescape('<a href="'.$link.'" '.$defaultAttr.$attr.'>') .
BOLTtranslate($label) . BOLTescape("$missingPage</a>");
}



On Sat, Aug 31, 2013 at 5:28 AM, Kevin Reed <[email protected]> wrote:

> Never really thought about this too much before but...
>
> If you want to display an image on a page you would use
>
>   [^imagename.png^]
>
> and it knows to get the link to it from [ROOT]/field/files/imagename.png
>
> But what if you want to provide a link to the same object.
>
>   [[/field/files/imagename.png|imagename.png]]
>
> Doesn't work, you get Invalid Link.
>
> Instead you have to give a full http URL to the object to do that.
>
>   [[http://sitename/field/files/imagename.png|imagename.png]]
>
> (also think PDF, DOC, some other non really displayable object that you
> want to provide a link to)
>
> Up to this point it has been just kind of a pain that you could just
> provide a relative link to the object using [[ ]].  When you have times you
> want to use the URL of the object, not display it.  Same is true for some
> other objects like PDF's.
>
> 1) Is there a syntax that would allow me to use [[ ]] to get to the object
> without providing a full link that I might have just missed?
>
> 2) Does someone have a function they use to already do this?  Ideally, it
> would allow for direct reference from anything from the top of the document
> root of the site but still be relative in form.
>
>  [[/scripts/somescript.php]]Somescript]]
>  [[/field/files/2003-12-meeting.pdf|2003-12 Meeting Notes PDF]]
>
> If not, I will write one... using some sort of other object descriptor
> instead of [[ ]].     Just thought I would ask.
>
> The goal btw is to make what is already a pretty relative format for a
> site completely relative.  Outside of this issue and the need to modify the
> index.php in what most people call as the field folder for the sites URL,
> the site is very relative and is easy to move from one virtual host to
> another same server or different.  I move sites around all the time and it
> one of the better features of the BW system.
>
> I plan on creating an rsync system which snarfs various admin virtual
> hosts on various client VPS servers to a central location which would allow
> access to their documentation, configuration notes etc... if their sites go
> down.  The less amount of tweaking needed after the rsync the better.
>
> --
> You received this message because you are subscribed to the Google Groups
> "BoltWire" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/boltwire.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to