From: Mitra <mi...@mi...> - 2003-01-15 08:23:53
|
So should we have a generic function that takes an itemid, reads the aliases from the slice's info, and then the content from the db and then creates an item? That function itself is easy, but needs two functions to make it work i.e. $aliases =3D slice_aliases($sliceid); $content =3D read_content_from_db($itemid); new $item("","",$aliases,"",""); $item->columns =3D read_content_from_db($itemid); I don't think the format string is needed? Since we are going to be expanding a view. The two functions I'm using above - i.e. slice_aliases($sliceid) and read_content_from_db($itemid) both seem to be missing, although they both seem pretty generic to me. - Mitra At 1:22 AM +0100 15/1/03, Honza Malik wrote: >Grabbed from admin/discedit.php3: > >// $dcontent - well known "Abstract Data Structure": >// $dcontent[$d_id]["d_state........."][0][value] >// $dcontent[$d_id]["d_state........."][0][flag] >$dcontent =3D GetDiscussionContent($item_id, "", "", false); > >// aliases array in standard form: >// $aliases["_#SUBJECT_"] =3D array( "fce" =3D> "f_h", >// "param" =3D> "d_subject.......", >// "hlp" =3D> "L_D_SUBJECT_ALIAS" ); > >// prepare >$item =3D new item("","",$aliases,"","",""); > >// format string >$text =3D "<tr><td> ..._#SUBJECT# </td> > <td>_#AUTHOR## .._#DATE####</td></tr>"; > >// assign format >$item->setformat($text); > >// assign item data >$item->columns =3D $dcontent[$d_id]; > >// print >echo $item->get_item(); > > > Honza > > >On =DAt, 2003-01-14 at 01:10, Mitra wrote: >> > >> >> P.S. I'd still like a hint on how to create a new "item" refering to >> > > an item id, this would be very useful for use of the site module, b= ut >> >> I can't figure out if this is possible. >> > >> >I'm not sure I understand, what you need. >> >> >> In the site, I have a parameter like --m1234 >> >> So I have an id of an item, - (actually a short id, but it doesn't >> really matter. ) >> >> What I would like to do is in module/site/sites/site_greenpages.php3 >> create an instance of the class "item" (as in include/item.php3) so >> that I can then do my unaliasing in that context. This would mean >> that within the site definition I could put >> >> _#HEADLINE or {headline........} or >> {alias:related........1:f_v:view.php3?vid=3D23&cmd[]=3Dx-23-_#this} >> >> etc etc >> >> But the code for creating the instance of the class item is pretty >> obscure, it is tightly coupled to the places it is used now, I'm >> looking for some guidelines to creating an instance of the class item > > starting with an id. > > > > - Mitra > > > >------------------------------------------------------- >This SF.NET email is sponsored by: Take your first step towards giving >your online business a competitive advantage. Test-drive a Thawte SSL >certificate - our easy online guide will show you how. Click here to get >started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en >_______________________________________________ >Apc-aa-coders mailing list >Apc...@li... >https://lists.sourceforge.net/lists/listinfo/apc-aa-coders -- Mitra Technology Consulting - www.mitra.biz - mi...@mi... 02-6684-8096 or 0414-648-0722 Life is a Mystery to be Lived, not a Problem to be Solved |