I wanted to use the “quick links” in my site but I didn’t see an easy way to use those so I made a plugin for members to create/edit/delete bookmarks that show up on my site. I haven’t picked a good DHTML menu system so I don’t have a demo readily available but I figured I post this plugin b/c I’m in need of some assistance on it. From the usage, I have a hack made to the core.input.php. I REALLY would like to do this a different way. If anyone knows please tell me. All I need is a way to pass information via url to this plugin (maybe via something else?). You can get the plugin here:
And if anyone knows about the communicate module, please visit my other post regarding email emailing and custom profile fields
Here’s the usage:
NOTE!!!!
———————————-
This script uses a hack to the core.input.php. I didn’t know of any other way to get the information by a link. If anyone knows, let me know. You have to add the follwoing to line 178 of core.input.php. It’s in the parse_uri function and after ‘does uri have session id’.
if(preg_match("/(.+)del_bookmark_id\=(\d+)(.*)/i",$uri, $matches)) {
$_GET['del_bookmark_id'] = $matches[2];
$uri = $matches[1] . $matches[3];
} else if(preg_match("/(.+)bookmark_id\=(\d+)(.*)/i",$uri, $matches)) {
$_GET['bookmark_id'] = $matches[2];
$uri = $matches[1] . $matches[3];
}
INSTALL
———————————
You can run the book_marks::install() function to generate the nessessary tables or you can just copy/paste the sql cmds into your choice of sql manager.
USAGE
——————-
I use the function bookmarkmanager to get all the GET information and take any actions. I just place it at the top of the template page. Messages will come from it if you don’t add the parameter msgs=“no”. Use it like this:
{exp:book_marks:bookmarkmanager}
—OR—
{exp:book_marks:bookmarkmanager msgs=“no”}
For editing and adding bookmarks, I use this form:
<form method=“post” action=”{path=to/thistemplate}” name=“bookmark_manager” onreset=“location.href=’{path=to/thistemplate}’”>
<input type=“hidden” name=“bookmark_edit” value=”{exp:book_marks:getinput which=“edit_id”}” />
<p>{exp:book_marks:getinput which=“title”}:<br />
<input type=“text” name=“bookmark_name” size=“40” maxlength=“240” value=”{exp:book_marks:getinput which=“name”}” style=“margin: 3px 3px 3px 10px;” />
<input type=“text” name=“bookmark_url” size=“40” maxlength=“240” value=”{exp:book_marks:getinput which=“url”}” style=“margin: 3px 3px 3px 10px;” /></p>
<input name=“submit” type=“submit” value=”{exp:book_marks:getinput which=“submit”}” style=“margin: 3px 3px 3px 10px;” /> <input type=“reset” value=“cancel” style=“margin: 3px 3px 3px 10px;” />
</p>
And this viewer (contains the edit/delete cmds):
<hr />
<h2>current bookmarks:</h2>
<table border=“0” cellspacing=“4” cellpadding=“0” width=“100%”>
<tr><td><p>name</p></td><td><p>location</p></td><td><p>controls</p></td></tr>
{exp:book_marks}
<tr>
<td><p style=“font-size: 12px;”><a href=”{bookmark_url}”>{bookmark_name}</a></p></td><td><p>{bookmark_url_short}</p></td>
<td valign=“top”><p><a href=”{path=to/thistemplate}{edit_bookmark}”>edit</a> | <a href=”{path=to/thistemplate}{delete_bookmark}” onclick=“javascript:return confirm(‘Are you sure you want to delete this bookmark?’)”>delete</a></p></td>
</tr>
{/exp:book_marks}
</table>
</form>
As you can see, book_marks has these possible values:
{bookmark_name} - The name of the bookmark that was added by the user.
{bookmark_url_short} - A way of truncating the url (incase it’s really long). Edit the php file to change.
{bookmark_url} - The URL of the bookmark.
{edit_bookmark} - An appendage to the URL to edit a bookmark (requires hack, see above!)
{delete_bookmark} - An appendage to the URL to delete a bookmark (requires hack, see above!)
