From: Honza M. <hon...@ec...> - 2003-01-15 09:44:37
|
Described functions are already there (grabbed from slice.php3): // 'slice_aliases' - is splited to two functions=20 list($fields,) =3D GetSliceFields($slice_id); $aliases =3D GetAliasesFromFields($fields); // read_content_from_db - axactly what does GetItemContent() // the $ids could be array of ids or single $id, $use_short_id is=20 // boolean indicating type of $ids (default is false =3D> unpacked) $content =3D GetItemContent($ids, $use_short_ids) Honza On St, 2003-01-15 at 09:16, Mitra wrote: > So should we have a generic function that takes an itemid, reads the=20 > aliases from the slice's info, and then the content from the db and=20 > then creates an item? >=20 > That function itself is easy, but needs two functions to make it work i= .e. >=20 >=20 > $aliases =3D slice_aliases($sliceid); > $content =3D read_content_from_db($itemid); > new $item("","",$aliases,"",""); > $item->columns =3D read_content_from_db($itemid); >=20 > I don't think the format string is needed? Since we are going to be=20 > expanding a view. >=20 > The two functions I'm using above - i.e. slice_aliases($sliceid) and=20 > read_content_from_db($itemid) both seem to be missing, although they=20 > both seem pretty generic to me. >=20 >=20 > - Mitra >=20 > 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" referi= ng to > >> > > an item id, this would be very useful for use of the site modu= le, but > >> >> 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.php= 3 > >> 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 it= em > > > 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 g= et > >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 >=20 |