News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF Links

Started by SMFHacks.com Team, July 12, 2006, 12:33:28 AM

Previous topic - Next topic

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Guillelmus

How do you increase the character limit of description?

Thanks for the great mod!

Baloch

is there any way to display latest links in HTML or PHP file?

Guillelmus

Quote from: Baloch on December 05, 2011, 09:18:04 AM
is there any way to display latest links in HTML or PHP file?


http://askusaquestion.net/index.php/topic,2679.msg4466.html?PHPSESSID=e773b6a4550432c0e92661c42c8120de#msg4466

Code written by "Underdog"
global $smcFunc;
$limit = 10;

/* sql queries */
$link_columns = array('ID_LINK', 'ID_MEMBER', 'ID_CAT', 'url', 'title', 'description', 'hits', 'approved', 'rating', 'date');
$cat_columns = array('title', 'description', 'image');

$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links_cat WHERE (ID_CAT > 0) ORDER BY ID_CAT");
while ($val = $smcFunc['db_fetch_assoc']($result1))
{
if (empty($val['ID_CAT']))  {continue;}
foreach ($cat_columns as $column)
{$cats[$column][$val['ID_CAT']] = $val[$column];}
}
$smcFunc['db_free_result']($result1);

$count1 = 0;
$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links WHERE (approved > 0) ORDER BY date DESC LIMIT {$limit}");
while ($val = $smcFunc['db_fetch_assoc']($result1))
{
foreach ($link_columns as $column)
{
if (empty($val[$column]))  {$val[$column] = false;}
$links[$column][$count1] = $val[$column];
}
foreach ($cat_columns as $column)
{
$links[ 'cat_' . $column][$count1] = $cats[$column][$val['ID_CAT']];
}
$count1++;
}
$smcFunc['db_free_result']($result1);

/* display */
$count2 = 0;
echo '<table cellspacing="14" style="margin:auto;">
<tr class="titlebg"><td>Link</td><td>Category</td><td>Description</td><td>Hits </td></tr>';

while ($count2 < $count1)
{
echo '<tr class="windowbg"><td><a href="'.$links['url'][$count2].'">',$links['title'][$count2],'</a></td><td>',$links['cat_title'][$count2],'</td><td>',$links['description'][$count2],'</td><td style="text-align:center;">', $links['hits'][$count2],'</td></tr>';
$count2++;
}
echo '</table>';


I assume this code can be distributed...

vbgamer45

Quote from: Guillelmus on December 03, 2011, 10:53:50 AM
How do you increase the character limit of description?

Thanks for the great mod!
You have to alter the description column in sql

ALTER table smf_links change description description text;
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Baloch

Quote from: Guillelmus on December 05, 2011, 09:48:00 AM
Quote from: Baloch on December 05, 2011, 09:18:04 AM
is there any way to display latest links in HTML or PHP file?


http://askusaquestion.net/index.php/topic,2679.msg4466.html?PHPSESSID=e773b6a4550432c0e92661c42c8120de#msg4466

Code written by "Underdog"
global $smcFunc;
$limit = 10;

/* sql queries */
$link_columns = array('ID_LINK', 'ID_MEMBER', 'ID_CAT', 'url', 'title', 'description', 'hits', 'approved', 'rating', 'date');
$cat_columns = array('title', 'description', 'image');

$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links_cat WHERE (ID_CAT > 0) ORDER BY ID_CAT");
while ($val = $smcFunc['db_fetch_assoc']($result1))
{
if (empty($val['ID_CAT']))  {continue;}
foreach ($cat_columns as $column)
{$cats[$column][$val['ID_CAT']] = $val[$column];}
}
$smcFunc['db_free_result']($result1);

$count1 = 0;
$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links WHERE (approved > 0) ORDER BY date DESC LIMIT {$limit}");
while ($val = $smcFunc['db_fetch_assoc']($result1))
{
foreach ($link_columns as $column)
{
if (empty($val[$column]))  {$val[$column] = false;}
$links[$column][$count1] = $val[$column];
}
foreach ($cat_columns as $column)
{
$links[ 'cat_' . $column][$count1] = $cats[$column][$val['ID_CAT']];
}
$count1++;
}
$smcFunc['db_free_result']($result1);

/* display */
$count2 = 0;
echo '<table cellspacing="14" style="margin:auto;">
<tr class="titlebg"><td>Link</td><td>Category</td><td>Description</td><td>Hits </td></tr>';

while ($count2 < $count1)
{
echo '<tr class="windowbg"><td><a href="'.$links['url'][$count2].'">',$links['title'][$count2],'</a></td><td>',$links['cat_title'][$count2],'</td><td>',$links['description'][$count2],'</td><td style="text-align:center;">', $links['hits'][$count2],'</td></tr>';
$count2++;
}
echo '</table>';


I assume this code can be distributed...

Its so much nice script but I need to display only random links from this directory. means single column with link ID from different categories.

Guillelmus

Quote from: Baloch on December 08, 2011, 12:21:11 AMIts so much nice script but I need to display only random links from this directory. means single column with link ID from different categories.
Search
$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links WHERE (approved > 0) ORDER BY date DESC LIMIT {$limit}");

Replace$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links WHERE (approved > 0) ORDER BY RAND() DESC LIMIT {$limit}");

Here's a version that fetches three links at random.global $smcFunc;
$limit = 3;

/* sql queries */
$link_columns = array('ID_LINK', 'ID_MEMBER', 'ID_CAT', 'url', 'title', 'description', 'hits', 'approved', 'rating', 'date');
$cat_columns = array('title', 'description', 'image');

$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links_cat WHERE (ID_CAT > 0) ORDER BY ID_CAT");
while ($val = $smcFunc['db_fetch_assoc']($result1))
{
if (empty($val['ID_CAT']))  {continue;}
foreach ($cat_columns as $column)
{$cats[$column][$val['ID_CAT']] = $val[$column];}
}
$smcFunc['db_free_result']($result1);

$count1 = 0;
$result1 = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}links WHERE (approved > 0) ORDER BY RAND() DESC LIMIT {$limit}");
while ($val = $smcFunc['db_fetch_assoc']($result1))
{
foreach ($link_columns as $column)
{
if (empty($val[$column]))  {$val[$column] = false;}
$links[$column][$count1] = $val[$column];
}
foreach ($cat_columns as $column)
{
$links[ 'cat_' . $column][$count1] = $cats[$column][$val['ID_CAT']];
}
$count1++;
}
$smcFunc['db_free_result']($result1);

/* display */
$count2 = 0;
echo '<table cellspacing="0" style="margin:auto;">
<tr class="titlebg"><td>Linkki</td><td>Luokka</td><td>Kuvaus</td></tr>';

while ($count2 < $count1)
{
echo '<tr class="windowbg"><td><a href="'.$links['url'][$count2].'">',$links['title'][$count2],'</a></td><td>',$links['cat_title'][$count2],'</td><td>',$links['description'][$count2],'</td></tr>';
$count2++;
}
echo '</table>';

GlitchPC

Running SMF 2.0.2, along with the latest version of this mod.  (see attached image)

Why are there two different edit/delete links in this mod?

If the above is normal...then, why isn't there a description for the secondary drop-down menu?

Thanks, in advance...

Kindred

hmmmm?   Where do you see that?
Using v2.3.2,  In user permissions, I see the attached....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GlitchPC

#869
Go into Admin/Members/Permissions

I should note...I'm using the "Simple" view...as opposed the the "Classic" view.

Would also like to know the difference between General Permissions for this Mod and Category Permissions.

One last thing...

What template/file do I edit the catbg for categories?  (see attached image)

Thanks, in advance...

vbgamer45

Quote from: GlitchPC on December 26, 2011, 10:20:53 AM
Go into Admin/Members/Permissions

I should note...I'm using the "Simple" view...as opposed the the "Classic" view.

Would also like to know the difference between General Permissions for this Mod and Category Permissions.

One last thing...

What template/file do I edit the catbg for categories?  (see attached image)

Thanks, in advance...
Under Classic  permission View the Edit and Delete Links should have radio buttons to edit own links or any link the same with delete. I don't believe the simple view shows the radio buttons.


General Permissions are global permissions. Category permissions override the global permissions. If you want certain membergroups to have different permissions such as viewing some categories or adding links or not adding links.

The file would be in themes/default/Links2.template.php
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

GlitchPC


GlitchPC

Another question...and hopefully, the last.  We all know how that goes, though...don't we?

Anyhow...I noticed for those groups that do not have the ability to edit link "Options"...the "Options" column still appears for them.

Is there any way to modify this so the "Options" column does not appear for those groups?

vbgamer45

Quote from: GlitchPC on December 26, 2011, 01:50:19 PM
Another question...and hopefully, the last.  We all know how that goes, though...don't we?

Anyhow...I noticed for those groups that do not have the ability to edit link "Options"...the "Options" column still appears for them.

Is there any way to modify this so the "Options" column does not appear for those groups?
Released an update for this

2.4
!Fixed options column to only show if they have permission to manage a link in the result returned.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

GlitchPC

Thanks for that...and that was quick!

Uninstall and reinstall?  or just update after zip file upload?

vbgamer45

You can just install the new version on top as well.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

GlitchPC

Suggestions for improvements:

  • Instead of a "thumbs-up/thumbs-down" rating...use the "5-star" method.  The way it is now...just doesn't look very appealing.
  • Admins should be able to set the length of the link description, as well as the link title.
Just sayin'...

Nice mod, all-around, though.  Very easy to use and implement.

vbgamer45

Yeah probably should move to five star ratings. This is was one of the first mods I have made and slowly update it over time.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

GlitchPC

Quote from: vbgamer45 on December 27, 2011, 04:24:12 PM
Yeah probably should move to five star ratings. This is was one of the first mods I have made and slowly update it over time.

It's actually a great mod, vbgamer.  Like I said...it's very easy to install...setup...and use.  Some bling other mods use like thumbnail images...I could care less about.  The only thing I was missing on my site was an easy method for members to add links...and this has it ALL covered...hands down!

Thanks, for a great mod.

GlitchPC

#879
Well...one last question...I hope.  Didn't I say that before?

What template and what code do I need to modify to change the titlebg for the below image?  (see attached)

Basically...I want to change the text of the words "Sub Categories:", to black and change the background color for the header.


Thanks, in advance...

Update...

Nevermind...I found it and made the changes to the code, myself.  I guess I should look before I leap, huh?

Advertisement: