[ewiki] Re: [.subpage]-Linking

I like the functions as described, but feel that [2] should be off by
default.  Navigation could be complex if subpages are indistinguishable in
view, we could use a css classes or some other method to provide this hint
though.

Andy 




> -----Original Message-----
> From: massenmensch [mailto:kontakt@xxxxxxxxxxxxxxx]
> Sent: Thursday, February 12, 2004 11:31 AM
> To: ewiki@xxxxxxxxxxxxx
> Subject: [ewiki] [.subpage]-Linking
> 
> Hi Ewikians!
> 
> I've gone back to fiddling w/ my ewiki-implementation again and
> implemented
> easier subpage-linking. This is how it works.
> 
> Status quo:
> * ewiki is capable of handling subpage-structured pagenames/ids, e.g.
>   [readme.chapter1.section2]
> * ewiki shows subpages of a page via
> include("plugins/aview/subpages.php");
> 
> easier linking [1]
> ---------------
> 
> My additions now allow to link from a page to one of its subpages more
> easily,
> e.g. you can link from [readme] to [readme.chapter1] by [.chapter1].
> 
> link only showing subpage-name? [2]
> --------------------------------------
> 
> The following feature I implemented, too. I'd like to discuss, whether you
> think it to be good for default behaviour or option.
> 
> When linking as above from [readme] to [readme.chapter], I'd like the link
> to
> be <a href="readme.chapter">chapter</a>. What do you think?
> 
> Mario, if there is a better way of submitting changes, then let me know.
> Greetings to all of you, timm
> 
> the code
> ----------
> 
> ## for [1] ##
> 
> [POSITION 1]
> 
> ADD  if ($str[0] == ".") { $str = $ewiki_id.$str;  }  IN function
> ewiki_link_regex_callback LAST LINE OF if ($str[0] == "[")-CONDITION
> 
> FOR FULL CODE SEE BELOW
> 
> [POSITION 2]
> 
> ADD
> 
>   global $ewiki_id;
>   if ($action=="FIND") {
>    foreach ($args as $i=>$id) {
>       if ($id[0] == ".") { $id = $ewiki_id.$id;  }
>       $args[$i] = $id;
>    }
>   }
> 
> IN THE BEGINNING OF function ewiki_database
> 
> 
> ## for [2] ##
> 
> ADD
>       $tymm_rest = strrchr($title,'.');
>       if ($tymm_rest) {$title = substr($tymm_rest,1); }
> IN  function ewiki_link_regex_callback BEFORE if ($uu = strtok("|"))
> 
> ## SO THE BEGINNING OF ewiki_link_regex_callback IS NOW: ##
> 
> function ewiki_link_regex_callback($uu, $force_noimg=0) {
> 
>    global $ewiki_links, $ewiki_plugins, $ewiki_config, $ewiki_id;
> 
>    $str = trim($uu[0]);
>    $type = array();
>    $states = array();
> 
>    #-- link bracket '[' escaped with '!' or '~'
>    if (($str[0] == "!") || ($str[0] == "~")) {
>       return(substr($str, 1));
>    }
>    if ($str[0] == "#") {
>       $states["define"] = 1;
>       $str = substr($str, 1);
>    }
>    if ($str[0] == "[") {
>       $states["brackets"] = 1;
>       $str = substr($str, 1, -1);
>       /* SUBPAGE-HACK: easy sublinking by [.subpage] */
>       if ($str[0] == ".") { $str = $ewiki_id.$str;  }
>       /* END SUBPAGE-HACK */
>    }
>    #-- explicit title given via [ title | WikiLink ]
>    $href = $title = strtok($str, "|");
>    /* SUBPAGE-HACK: removing.everything.but.LAST for link-display */
>       $tymm_rest = strrchr($title,'.');
>       if ($tymm_rest) {$title = substr($tymm_rest,1); }
>    /* END SUBPAGE-HACK */
> 
>    if ($uu = strtok("|")) { ...
> 
> 
> 
> 
> 
> _________________________________________________
> Scanned on 12 Feb 2004 17:23:33
> Scanning by http://erado.com

Other related posts: