| [Code snippets for layout layer] - [Parse <lj user=*> tags / make "Add as User Icon" buttons] |
[Apr. 14th, 2005|04:35 pm]
FB Layers
|
Two snippets. First, a function to parse strings for <lj user=*> and < comm=*> tags. Also includes a recursive function to find the earliest occurrence of a substring in a larger string using a binary search. These functions are useful for parsing picture or gallery descriptions.
( CodeCollapse )
The second snippet is HTML (encased in strings) for a form button that lets any user add an image's thumbnail as their own LJ user icon, assuming they're logged in. The URL, Keywords, and Comments values assume you're in Gallery View on the Super Simple style (having run $this->load_pict_descriptions()) but it's pretty simple to adapt to any view, just change $i.url, $p.title, and $p.des to the correct values for the image's thumbnail, title, and description respectively.
( CodeCollapse )
I recommend setting properties in your layout for the use of these snippets. You can see an example in my modified Super Simple style, number 14200. This gallery (and each of its subgalleries) is using the style right now, if you want to see an example. |
|