From: Krishna E. B. <keb@Cyblings.ON.CA> - 2001-04-17 21:18:41
|
Here's some code i'm testing on my development box that does the stuff Mark mentioned: it is an enhancement to f_f() in includes/item.php3 # prints link to fulltext view of item as a url. typical use: headline url. # col: hl_href......... # param: link_only:redirect # link_only - id of field (like "link_only.......") specifying whether fulltext view is offsite. # redirect - url of another page which shows the content of item; # - this page should contain SSI include ../slice.php3 too; # - if given as "[target_field....]" fulltext will be viewed in editor-chosen Target Template, # and slice id will be added to url. function f_f($col, $param="") { $p = explode(":",$param); if( $p[0] AND $this->columns[$p[0]][0][value] ) { # link_only contains a field id. # the dereferenced field says yes, hl_href field contains an external url. return $this->columns[$col][0][value]; } if( $p[1] ) { # redirect to another page. $need_slice = false; $tmp = trim($p[1]); if (ereg("^\[([a-z0-9_.]{16})\]$", $tmp, $regs)) { # a field id enclosed in []. $need_slice = true; $p[1] = $this->columns[$regs[1]][0][value] . ".shtml"; echo "field=[$tmp], target=[" . $p[1] . "]\n"; } //return con_url( $p[1], "sh_itm=".unpack_id($this->columns["id.............."][0][value])); return con_url( $p[1], ($need_slice ? "slice_id=" . unpack_id($this->columns["slice_id........"][0][value]) . "&" : "") . "sh_itm=" . unpack_id($this->columns["id.............."][0][value])); } else { return con_url( $this->clean_url, # show on same page as index view. "sh_itm=".unpack_id($this->columns["id.............."][0][value])); } } to use it, the person with administrator permissions has to set the second parameter to a field id in square brackets []. also, they create another field that contains the destination shtml template name. i did that field as a dropdown constant list so that adminsitrators could make it easy for editors to choose a valid template. however, if the administrator puts a normal value in the second parameter, it overrides whatever selection the editor might make. i chose that approach instead of a third parameter because the first two parameters are separated with a : which can be part of a url and would confuse the explode parameter parsing function. maybe better to change the separator to a , but that would break existing installations... i'll set it up on a server so yall can see it, if you think it's worthwhile -Krishna Mark wrote: > What we are now imagining is an even smarter version of this alias which > would combine you go.php3 function with a number of other functions. In > addition to switching between internal and external, we would like to make > this function do the following: > > - choose whether the headline URL is internal or external > - insert an .shtml template name into internal URLs (for different full text > templates) > - choose whether to go back to the parent slice / item for internal URLs > > Does this make sense to you? Would it be a good thing for us to work on? Or > would it be better for you to work on it? > > Thanks again for your help ... > > - Mark > > > _______________________________________________ > apc-aa-general mailing list > apc...@li... > http://lists.sourceforge.net/lists/listinfo/apc-aa-general > -- Krishna E. Bera <ke...@cy...> |