Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Links Manager (was Link Manager 2)
#26
v1.9.1

Another update to allow use of internal pages instead of urls.
If you choose an internal page the url field will be disabled and the url will be lost when saved.
If a page is deleted (or page slug is changed) then the link will no longer reference it.

Also fixed a change order problem which relied on the url being present. The order is now maintained by unique ids.
Reply
#27
Seems to work fine mostly.

When I go to http://validator.w3.org/ it says there's no alt text for the thumbs.

This testpage with the list without links. It seams if I hover my mouse over the image + Name, I get the description in a hovering-textbox, but the discription is already present in the page.

Or is it possible to alter this in css?
Reply
#28
v2.0
I have completed a rewrite of the code. It was a real mess and getting to be a real pain to maintain Smile. Note the name change as well.

I have updated the first post of this thread with complete list of functions and usage.
Reply
#29
(2013-09-27, 04:50:23)datiswous Wrote: Seems to work fine mostly.

When I go to http://validator.w3.org/ it says there's no alt text for the thumbs.

I did see this post. Sorry for the late reply.
I have included the link name as the alt text for the icons and it seems to validate fine now. Cheers for the heads up.

Quote:This testpage with the list without links. It seams if I hover my mouse over the image + Name, I get the description in a hovering-textbox, but the discription is already present in the page.

Or is it possible to alter this in css?

I don't think you can alter this in css.
I have changed it so if you are showing the description as text then it is not included as the title (the pop-up text box).
Reply
#30
v2.0.1

Corrected filter so that link and search_links can contain spaces.
Reply
#31
v2.0.2

Added instructions tab.
Reply
#32
Excellent plugin, but I'm having trouble with the random function.

I have 13 links (id's 0 to 12) and use the random function as below.

get_randlink(0,99);

I am setting the max id to 99 to allow for new links that may be added, however every now and then the function appears to be returning 'null'. If I set the maximum to 12 or less all is good but obviously I don't want to be updating this every time the user adds a new link!

Anyone know where I'm going wrong or is this a bug?
Reply
#33
(2013-11-21, 07:28:02)pcooper Wrote: ...
Anyone know where I'm going wrong or is this a bug?


Not being much of a Php artist, when I originally got this working, I just wanted something which changed my front page with the odd random link, and a nice image of it. The aim was to make my front page look fresh and different every time you visit. My icon images are all 300x250 screenshots of where you are heading, so sit nicely to show off the destination link. I have over 750 links and so this was never going to be a problem really for me. It's basically working like the randbetween function of spreadsheets.

I like the idea that you can pick out particular sections of your links, so that if you reorder the xml file by categories, then renumber them, you can put up a random link from a particular category.

There is no code built into the function to find your max_id_number or on_error settings; however someone who knows Php may be able to add them.

For now I suggest setting it to your highest id number and changing it down the line. It won't take that long.

And listen out and perhaps someone will work out how to find the max_id and if the second variable is greater than max_id, will lower the second variable to max_id.

Anyone?

MTW
Reply
#34
(2013-11-21, 07:28:02)pcooper Wrote: Anyone know where I'm going wrong or is this a bug?

Apologies for this. It was a bug (and a truly bad rookie mistake on my part Smile). If the max id is greater than the number of links it defaulted to the max id. I stupidly set the max id to the number of links but since the id's start at 0 then the max id should be 1 less.
This is why you would get null results on occasion (only if it was getting the max id returned).

v2.0.3
I have corrected it now and also added the use of get_randlink() with no arguments.

get_randlink($min, $max) - get random link between $min and $max.
get_randlink($max) - get random link between 0 and $max.
get_randlink() - get random link between 0 and max link id.

So get_randlink(0, 9999), get_randlink(9999) and get_randlink() all do exactly the same thing if you have less than 9999 links.
Reply
#35
(2013-11-23, 19:37:30)mtw Wrote: And listen out and perhaps someone will work out how to find the max_id and if the second variable is greater than max_id, will lower the second variable to max_id.

The code has always defaulted to the max_id. So there is no need to get it to use in the functions.

If you desperately need it for another reason then you can access the class method by using ...
global $lm_links;
echo $lm_links->max_link_id();
Reply
#36
Thanks for the improving of this plugin. It works great, the only thing I miss is an option to browse to a thumnail or image placed in the uploads folder.
Reply
#37
(2013-11-30, 00:27:34)Rene Wrote: Thanks for the improving of this plugin. It works great, the only thing I miss is an option to browse to a thumnail or image placed in the uploads folder.

Hi Rene - thanks for the input and kind words.

v2.0.4
I have added the ability to choose an image or thumbnail using the filebrowser from uploads folder. The button is on the link edit page next to the icon url text box. It should fill in automatically with the chosen image url.

Hope thats what you were after.
Reply
#38
(2013-11-26, 11:28:13)mrdragonraaar Wrote: Apologies for this. It was a bug (and a truly bad rookie mistake on my part Smile). If the max id is greater than the number of links it defaulted to the max id. I stupidly set the max id to the number of links but since the id's start at 0 then the max id should be 1 less.

Thank you for fixing the bug, all seems to be ok now!

Much appreciated.
Paul
Reply
#39
if the site is installed in a folder icons can not be selected
Reply
#40
Thnx for the work on this plugin.
I'am new to GetSimple, and found this plugin to do what i want to do.

I'am testing a website on my computer based on GetSimple with Links Manager Plugin, I run in to a problem with the Icon for a link.
When i browse for the Icon it is set to "http://localhost/data/uploads/LinkLogo/CIBG.jpg"

It return a error "Please enter a valid URL." so icons are not working for me.

Also i made a dutch translation for the plugin.


Attached Files
.zip   Dutch Language for Links Manager.zip (Size: 1.49 KB / Downloads: 1)
Reply
#41
I've only just found this links manager and like it a lot. It installs ok and works fine but the drag-n-drop link order sort doesn't drag and drop, so no sorting is possible. Has anyone else got this working?
Reply
#42
(2015-03-23, 01:51:38)davetest Wrote: I've only just found this links manager and like it a lot. It installs ok and works fine but the drag-n-drop link order sort doesn't drag and drop, so no sorting is possible. Has anyone else got this working?
I found that links_manager.js was not getting added to header.
PHP Code:
line 55 or links_manager.php was commented out:
//queue_script(LM_PLUGIN_ID, GSBACK);
edit to:
queue_script(LM_PLUGIN_IDGSBACK); 
Voila! - that got the D&D sorting working for me.
To get the image browser to work (for icons) I had to correct the path in line 69 of links_manager/js/links_manager.js
PHP Code:
From:
return 
window.open('/admin/filebrowser.php ...etc
To:
return window.open('
../admin/filebrowser.php ...etc 
because I'm using GS in a subdirectory.
I'm now really happy as I much prefer this plugin has over i18n Links Manager. Maybe one day that plugin will be updated to have function of this one from mrdragonraaar, especially being under it's own tab rather than in the plugins submenu. But for now I'll stick with this version Smile
Reply
#43
Hi guys,

can you help this poor coder <!-- me --> to find a way how to print array of links from category without html stuff ? I use this plugin a lot for many different things (slideshows, footer menus, intropage boxes etc) and creating own parsers for html with regexes or asXml structures is a pain .. :/ I looked at the code but my object programming skill is stuck somewhere in year 1900 Big Grin

Thanks for help !
Reply
#44
(2015-06-05, 19:50:10)morvy Wrote: Hi guys,

can you help this poor coder <!-- me --> to find a way how to print array of links from category without html stuff ? I use this plugin a lot for many different things (slideshows, footer menus, intropage boxes etc) and creating own parsers for html with regexes or asXml structures is a pain .. :/ I looked at the code but my object programming skill is stuck somewhere in year 1900 Big Grin

Thanks for help !

As far as the introductory post in this thread is confirmed, it seems impossible to return the raw data for the links, eg in a PHP array, and without the HTML? If this is (sadly) so, and the link is set on the href property in the return gotten with return_links, you could do something like this:

PHP Code:
<?php $links_html return_links(categoryId);
  
$captureHREFS '~(href=["\'])(.*?)(["\'])~';
  
preg_match_all($captureHREFS$links_html$links_dataPREG_PATTERN_ORDER);
  
$links_data $links_data[2];
  
  
// Now you can loop over the links & provide custom output
  
foreach ($links_data as $link) {
    echo 
'<span>Unconventional link template! ' $link '</span>';
  } 

Disclaimer: this hasn't been extensively tested.

NB to mrdragonraaar : I saw in the introductory thread that the 'echo parameter had been dropped in favour of a new return function'. IMHO return_anything should return the raw data associated with the data entity, because you never know whether the user agrees with the default output you choose. And you don't have to sacrifice the feature of returning the output & preprocessing it. EG, in GS Custom Settings if you want to get image data, you can do:
- return_setting('tab', 'image_field') which will return only the URL
- get_setting('tab', 'image_field') which will output an image tag
- get_setting('tab', 'image_field', false) which will return the image tag output.

Similarly (and to avoid needless regex replacements), you could have:
- return_links($catId) which would return an array of URLS
- get_links($catId) which would output a list of URLS, eventually with the option of using a component
- get_links($catId, false) which would return the default list output for preprocessing
Reply
#45
well, yes, that's similar to my code, but it's not very effective.. at least if I could cache the final output .. but I think it's possible to create a special function for return, but this plugin looks to be full of object and functions I'm totally lost in it Undecided there are some functions for retrieving, some for changing content and some for html enrichment of data, so just removing the html should make it
Reply
#46
Having become curious about the code because of your last reply, I had a look at it and holy..
I could barely believe the size & complexity of the codebase for something as basic as 'managing links'.

The plugin exposes a global $lm_links, but all properties are protected so no way to get the raw data, unless you modify the core with your own return function, or change existing ones.

I also noticed that the plugin is not compatible with PHP 5.2.x and under (it should mention PHP 5.3+). The preg_replace_callback functions in the functions.php file use an anonymous function while it should be a reference by string name for compatibility. See http://php.net/manual/en/function.preg-r...php#109248.

EDIT: fiddled with it. as a quick hack for returning a link category, go to links_manager/inc/Links.php, and on line 83, change the private keyword to public, then add the following code in links_manager/functions.php:

PHP Code:
function return_links_raw($catId) {
    global 
$lm_links;
    return 
$lm_links->get_by_category($catId);

This will return an array of Link objects for that categoryId, eg you'd access the first link in the first category's url like this: $link = return_links_raw(0)[0]->url.
Reply
#47
Thank you very much Tyblitz, that's exactly what I was talking about Smile
Reply
#48
Installed Version 2.0.4 and placed 
Code:
(% link_category:3 %)

On the page that I wanted it to appear, the category title came thru, but the links didn't... There is no manual to "RTFM Big Grin " so what am I doing wrong.  Testing with 2 links right now.
Thanks
Gene
Reply
#49
RTFFP Big Grin (first post Big Grin )

link_category:3 means show title of category 3, links:3 means show links from category 3 Wink
Reply
#50
(2015-06-16, 03:59:12)morvy Wrote: RTFFP Big Grin (first post Big Grin )

link_category:3 means show title of category 3, links:3 means show links from category 3 Wink

D'oH.. Thanks I'll give that a try...

OK, thanks a bunch Morvy, works great!!!!
Reply




Users browsing this thread: 1 Guest(s)