MemHT Portal is a Free PHP CMS and Blog
It permit the creation and the management online of websites with few and easy steps.
It's completelly customizable, expandable and suitable for all needs.
Moderators: Moderators
Page 1/2 1 2 >
Forum RSS feedReply
Mylinks as Directory
AuthorText
JPappi
Senior Member
Avatar

Posts: 293
Contributes: 70

Gender: _MALE_
Online: No
Date: 27/06/2008 18:06
Mylinks as Directory
#post8893
Please, be patient Smile
I want to get title and description from mylinks.
I add in inc_header.php the following code.
code
                        case "mylinks":
                                if ($checkop=="showCategory") {
                                        $row = $dblink->get_row("SELECT name FROM memht_mylinks_cat WHERE id=$checkid OR name='$checktitle'");
                                        $myltitle = outCode($row['name']);
                                       
                                        $sitetitle .= "$myltitle | ";
                                }
                        break;
 

Ok, now i get the title, but how can i get the description too?

By this way, there are more than 4000 links and over 400 cats and subcats in mylinks tables.
And it works allways fine and fast. Great job mem!
JPappi - have fun with memHT

Project at work: Find-4u.de

Image
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 4664
Contributes: 1971

Gender: _MALE_
Online: No
Date: 27/06/2008 18:13
Re: Mylinks as Directory
#post8896
I hope i understood well what are you looking for Smile

code
case "mylinks":
        if ($checkop=="showCategory") {
                $row = $dblink->get_row("SELECT name,description FROM memht_mylinks_cat WHERE id=$checkid OR name='$checktitle'");
        $myltitle = outCode($row['name']);
                $myldesc = outCode($row['description']);
               
                $sitetitle .= "$myltitle | ";
        }
break;
Delete Edit Quote
 
JPappi
Senior Member
Avatar

Posts: 293
Contributes: 70

Gender: _MALE_
Online: No
Date: 27/06/2008 18:28
Re: Mylinks as Directory
#post8898
Not realy, hehe
The descript should be shown as meta desc
JPappi - have fun with memHT

Project at work: Find-4u.de

Image
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 4664
Contributes: 1971

Gender: _MALE_
Online: No
Date: 27/06/2008 18:59
Re: Mylinks as Directory
#post8901
inc_header.php

before $sitetitle .= $siteConfig['site_name']; (row 230)

add
code
if ($page=="mylinks" AND $checkop=="showCategory") {
                $row = $dblink->get_row("SELECT description FROM memht_mylinks_cat WHERE id=$checkid OR name='$checktitle'");
                $pgds = outCode($row['description']);
        }
Delete Edit Quote
 
JPappi
Senior Member
Avatar

Posts: 293
Contributes: 70

Gender: _MALE_
Online: No
Date: 27/06/2008 19:45
Re: Mylinks as Directory
#post8902
Many Thanks, that's it.
JPappi - have fun with memHT

Project at work: Find-4u.de

Image
Delete Edit Quote
 
JPappi
Senior Member
Avatar

Posts: 293
Contributes: 70

Gender: _MALE_
Online: No
Date: 28/06/2008 16:33
Re: Mylinks as Directory
#post8932
I wanna add "hits" in mylinks.
Added hits in mylinks table.
Try something like this:
$dblink->query("UPDATE memht_mylinks SET hits=hits+1 WHERE id=$fid AND url='$furl'");

Hehe, it works but only for the first id in this cat.
What shall i do?
Edited: 28/06/2008 16:34
JPappi - have fun with memHT

Project at work: Find-4u.de

Image
Delete Edit Quote
 
paulo89
Moderator
Developer

Avatar

Posts: 1093
Contributes: 292

Gender: _MALE_
Online: No

Version: 3.8.1
Country: Portugal
Languages: Portuguese, Portuguese and little english ^^
Date: 28/06/2008 16:54
Re: Mylinks as Directory
#post8935
Hi

Is correct.
Maybe you have forgotten this:
code

$fid = intval($id);
 


or

code

$fid = (isset($_GET['fid'])) ? intval($_GET['fid']) : 0 ;
 
Image
Delete Edit Quote
 
JPappi
Senior Member
Avatar

Posts: 293
Contributes: 70

Gender: _MALE_
Online: No
Date: 28/06/2008 17:41
Re: Mylinks as Directory
#post8939
mmhm, it wont work paulo. In which function at which place i should add it?
JPappi - have fun with memHT

Project at work: Find-4u.de

Image
Delete Edit Quote
 
paulo89
Moderator
Developer

Avatar

Posts: 1093
Contributes: 292

Gender: _MALE_
Online: No

Version: 3.8.1
Country: Portugal
Languages: Portuguese, Portuguese and little english ^^
Date: 28/06/2008 17:51
Re: Mylinks as Directory
#post8940
Show me u function.
Image
Delete Edit Quote
 
JPappi
Senior Member
Avatar

Posts: 293
Contributes: 70

Gender: _MALE_
Online: No
Date: 28/06/2008 18:06
Re: Mylinks as Directory
#post8941
Here is it. Set in Section //Show links
code
function showCategory($id,$title,$ofsbgn,$ofsppg,$pg) {
        global $dblink,$siteConfig;
        $id = intval($id);
       
        $userating = 1;
       
        if ($row = $dblink->get_row("SELECT * FROM memht_mylinks_cat WHERE id=$id")) {
                $cid = intval($row['id']);
                $cparent = intval($row['parent']);
                $cname = outCode($row['name']);
               
                echo "<div align='center' class='tpl_addlink'><a href='http://www.memht.com/index.php?page=mylinks&op=addLink&id=$cid' title='"._ADD_LINK_."'>"._ADD_LINK_."</a></div>\n";
                echo "<div class='info' style='float:right;padding: 7px 10px 0px 0px'><a target='_blank' href='http://www.m-software.de/thumbshots/' rel='nofollow'>Thumbshots von M-Software.de</a></div><div class='box' style='margin-bottom:10px;'><b>$cname</b></div>\n";
                //Show subcategories
                if ($sresult = $dblink->get_list("SELECT * FROM memht_mylinks_cat WHERE parent=$cid ORDER BY name")) {
                        echo "<table width='80%' border='0' align='center' cellspacing='0' cellpadding='5' style='margin-bottom:10px;'>\n";
                        $a = 0;
                        foreach ($sresult as $srow) {
                                $sid = intval($srow['id']);
                                $sname = outCode($srow['name']);
                                $sdesc = outCode($srow['description']);
                               
                                $slinks = "<span class='info'>(".getLinks($sid).")</span>";
                                       
                                if (($a%2)==0) { echo "<tr>"; }
                                        echo "<td width='50%' valign='top'><img src='images/folder.gif' border='0' alt='Kategorie'> <a href='http://www.memht.com/index.php?page=mylinks&op=showCategory&id=$sid&title=".mem_urlencode($sname)."' title="header=[$sname] body=[$sdesc]"><b>$sname</b></a> $slinks</td>";
                                if (($a++%2)!=0) { echo "</tr>\n"; }
                        }
                        echo "</table>\n";
                        echo "<div class='underlined' style='margin-bottom:5px;'></div>\n";
                }
               
                //Show links
                if ($fresult = $dblink->get_list("SELECT * FROM memht_mylinks WHERE cat=$id AND flag=1 ORDER BY id DESC LIMIT $ofsbgn,$ofsppg")) {
                        foreach ($fresult as $frow) {
                                $fid = intval($frow['id']);
                                $fname = outCode($frow['name']);
                                $furl = outCode($frow['url']);
                                $fdesc = outCode($frow['description']);

                                $row = $dblink->get_row("SELECT COUNT(id) AS num_votes, SUM(vote) as tot_votes FROM memht_ratings WHERE whr=7 AND wid=$fid");
                                $tot_votes = intval($row['tot_votes']);
                                $num_votes = intval($row['num_votes']);
                               

                                $dblink->query("UPDATE memht_mylinks SET hits=hits+1 WHERE id=$fid AND url='$furl'");
                       

                        echo "<div><table border='0' width='100%' id='table1' cellspacing='0' cellpadding='0'>
                                <tr>
                                <td width='120' style='padding: 9px 9px 0px 9px' valign='top'><a title='$fname' target='_blank' href='$furl'><img height='90' alt='' width='120' border='0' src='http://www.m-software.de/screenshot/Screenshot.png?url=$furl&delay=2&scale=10&width=120&height=90' alt='$fname'></a></td>
                                <td valign='top' style='padding-right:9px'><a href='$furl' title='$fname' target='_blank'><span style='font-size:110%;' class='tpl_comments_title'><b>$fname</b></span></a>"
;
               
                                        if ($userating==1) {
                                                        echo "  ";
                                                        $rank = @round($tot_votes/$num_votes);
                                                        if (file_exists("templates/".$siteConfig['template']."/images/stars/off.gif")) {
                                                                $offimg = "templates/".$siteConfig['template']."/images/stars/off.gif";
                                                        } else {
                                                                $offimg = "images/rate/off.gif";
                                                        }
                                                        if (file_exists("templates/".$siteConfig['template']."/images/stars/on.gif")) {
                                                                $onimg = "templates/".$siteConfig['template']."/images/stars/on.gif";
                                                        } else {
                                                                $onimg = "images/rate/on.gif";
                                                        }
                                                        $offstars = 5-$rank;
                                                        for ($i=1;$i<=5;$i++) {
                                                                $rankimg = ($i<=$rank) ? $onimg : $offimg ;
                                                                echo "<a href='http://www.memht.com/index.php?page=mylinks&op=vote&id=$fid&rank=$i' title='header=["._UVOTE_."] body=[$i]'><img src='$rankimg' border='0'></a>";
                                                        }
                                                }
                                                echo "</div>";
                                                echo "<div style='margin:2px 0;'>$fdesc</div>";
                                                echo "<div class='info'><i>$furl</i></td>
                                </tr>
                                <tr>
                                        <td colspan='2' style='padding:0 10px'><hr size='1' color='#cccccc'></td>
                                </tr>
                                </table></div>"
;
                               
}

                        //Pages
                        include_once("inc/class/paginationSystem.class.php");
                        $ps = new paginationSystem();
                        $ps->items = $ofsppg;
                        $ps->actpg = $pg;
                        $ps->query = "SELECT id FROM memht_mylinks WHERE cat=$id AND flag=1";
                        $ps->url = "index.php?page=mylinks&op=showCategory&id=$cid&title=".mem_urlencode($title)."&pg={{N}}";
                        $ps->show();
                } else {
                        echo "<div align='center' style='padding:5px 0;'>Bitte tragen Sie Ihre Webseite in einer <b>Unterkategorie</b> ein!</div>\n";
                        include_once("blocks/block_siteofmoment.php");
                        include_once("blocks/block_main_advertising.php");
                }
        } else {
                echo "<div align='center' id='errorText' class='box'><b>"._EMPTY_."</b></div>";
        }
}

function addLink($id) {
        global $dblink;
        $id = intval($id);
       
        if ($row = $dblink->get_row("SELECT name FROM memht_mylinks_cat WHERE id=$id")) {
                $cat = outCode($row['name']);
               
                echo "<form name='form_com' method='post' action='index.php?page=mylinks&op=addLinkCheck&id=$id'>\n";      
                        echo "<div align='center'><table border='0' cellpadding='3' cellspacing='0' class='box' style='text-align:left; padding:1px 6px;'>\n";
                                echo "<tr><td>"._CATEGORY_."</td><td><input type='text' value='$cat' size='40' maxlength='255' disabled></td></tr>\n";
                                echo "<tr><td>"._SITENAME_."</td><td><input type='text' name='sitename' size='40' maxlength='255'></td></tr>\n";
                                echo "<tr><td>"._SITEURL_."</td><td><input type='text' name='siteurl' value='http://www.' size='40' maxlength='255'></td></tr>\n";
                                echo "<tr><td>"._EMAIL_."</td><td><input type='text' name='email' size='40' maxlength='255'></td></tr>\n";
                                echo "<tr><td valign='top'>"._DESCRIPTION_."</td><td><textarea name='description' cols='35' rows='10'></textarea></td></tr>\n";
                                echo "<tr><td colspan='2' align='center'><input type='submit' name='Submit' value='"._ADD_LINK_."'></td></tr>\n";
                        echo "</table></div>\n";
                        echo "<input type='hidden' name='category' value='$id'>\n";
                echo "</form>\n";
        } else {
                echo "<meta http-equiv='refresh' content='0;URL=index.php?page=mylinks'>";
        }
}
 
JPappi - have fun with memHT

Project at work: Find-4u.de

Image
Delete Edit Quote
 
Reply
Page 1/2 1 2 >
Tags Cloud
Advertising
News Archive
Language
Help MemHT Portal
Navigator
Users Block
Hi Guest
IP: 38.103.63.59

Username
Password
New files
MemHT Wiki
Friends
MemHT Portal is a free software released under the GNU/GPL License by Miltenovik Manojlo