SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Az
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to do some minor tweaking to "inlink" to use it on my site. It's a php/mySQL link manager which uses templates to allow customizing. However, I want to list some names which do not have links associated with them. The problem is that it assigns an id to the name and automatically assumes it's a link and forces a
    http://mysite.com/links/go.php?id=9&url= whatever is entered in form URL field. If the field is left blank you get the line above with proper id#, and "&url=", nothing after the =, so it goes to a 404 page.

    I don't know any php yet, can someone tell if this can be modified to do something like "if url field is blank, skip this step and don't make it a link"? Here's the part of the functions.txt that looks like it controls it:

    $result = mysql_query($linkq);
    if ($row = mysql_fetch_array($result)) {
    do {
    $file = fopen($LINKTEMP, "r");
    $linktemp = fread($file, filesize($LINKTEMP));
    fclose($file);

    $linkname = stripslashes($row["name"]);
    $linkurl = "go.php?id=" . $row["linkid"] . "&url=" . $row["url"];
    $linkdescrip = stripslashes($row["linkdesc"]);
    $dateadded = $row["date"];
    $dateadded2 = date($datefmt,$dateadded);

    The catch is I only want it to NOT make a link if no information is entered for "URL", if info is entered I want it to do what it's supposed to. Thanks for any help!!

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We would need to see the part of the script that echo's the link to the browser. But the answer to you question is "Yes it is possible to do what you want".
    Marty H.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Az
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the linktemplate.txt from what I can figure this looks like what you're looking for:

    <font class="text">
    <a href="<%INSERT_LINKURL%>"><%INSERT_LINKNAME%></a>
    </font><sup><%INSERT_TOP%><%INSERT_POP%><%INSERT_NEW%></sup> - <font class="linkdesc"><%INSERT_LINKDESCRIPTION%></font><font class="text">
    <font class="linkdesc">(</font><font class="linkdesc2">Added: </font><font class="linkdesc2"><%INSERT_DATEADDED%></font> <font class="linkdesc2">Hits/font> <font class="linkdesc2"><%INSERT_HITS%></font><font class="linkdesc2"> Rating/font> <font class="linkdesc2"><%INSERT_RATING%></font> <font class="linkdesc2">Votes/font> <font class="linkdesc2"><%INSERT_VOTES%>)</font> <a href="<%INSERT_RATEURL%>">Rate It</a> <a href="<%INSERT_RATEURL%>"><%INSERT_RATING_IMG%></a>
    </font>
    <br>
    <br>

  4. #4
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that the template forces you to have a link there, so you would have to modify the template..

    for example, instead of <a href="<%INSERT_LINKURL%>"><%INSERT_LINKNAME%></a>, you could use <%INSERT_LINK_AND_URL%> in your template, and in the PHP code, you can check to see if $row["url"] contains anything, and if it does, you can echo a link, if not, you can echo the link name.
    PHP Code:
    $linkname stripslashes($row["name"]);
    if (
    $row["url"])
    {
       
    $linktext "<a href=\"go.php?id=" $row["linkid"] . "&url=" $row["url"] . "\">$linkname</a>";
    } else {
      
    $linktext $linkname;

    You probably have some text like:

    $linktemp = ereg_replace("<%INSERT_LINKNAME%>", $linkname, $linktemp);
    $linktemp = ereg_replace("<%INSERT_LINKURL%>", $linkurl, $linktemp);

    and you could replace that with:

    $linktemp = ereg_replace("<%INSERT_LINK_AND_URL%>", $linktext, $linktemp);

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Az
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks sooooo much for the help, I'll go give it a shot and see what happens!

    Ok, replaced what you suggested. Still the name is showing up as a link "http://mydomain.com/links/go.php?id=20&url=http://" That was with me deleting the http:// in the form field while adding the listing, so the URL field was empty.

    If I add a listing with the http:// in the form field it does not add another "http://" so maybe it checks for "http://" if none entered it adds it somewhere.....????

    Here's where it's at, bottom two listings show results:
    http://65.108.62.194/links
    Last edited by JohnAz; May 15, 2001 at 15:13.

  6. #6
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you could use ssLinks instead

    /me apologises for blatently pimping his mySQL links database thingy yet again...

  7. #7
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by JohnAz
    Ok, replaced what you suggested. Still the name is showing up as a link "http://mydomain.com/links/go.php?id=20&url=http://" That was with me deleting the http:// in the form field while adding the listing, so the URL field was empty.

    If I add a listing with the http:// in the form field it does not add another "http://" so maybe it checks for "http://" if none entered it adds it somewhere.....????
    Hmmm.. I'm not sure what would cause that, without looking at more of the script.. Maybe it is time to use ssLinks

  8. #8
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, let's say that it is adding a http:// if you give an empty URL field.. we could try changing the condition from

    if ($row["url"])

    to

    if ($row["url"] && $row["url"] != "http://")

  9. #9
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Az
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cokeman, ..... It appears that adding your last line has done it! I just went and stuck it in the functions.txt file, viewed my links page and the listing with no link is there with no link function! I'll go add a couple more listings and see what happens.

    As far as "sslinks"... I'll go take a look at it, I don't care what I use as long as I can have admin control, limit users additions, and really customize the look.

    My goal here is to have a directory that has paid advertisers listed with links, free listings mostly without links...just name, address, phone, of course the paid ones would need to be placed above unpaid. Then I need this directory to be on pages where I can have category specific banners, or other form of pictures that can be rotated every week or so. Inlink solves this by having "root" level listings showing prior to digging into the subcategories. I think by modifying "date added" I can keep paids above non-paids.

    If sslinks can do something similar it would work. I'll go take a gander at it.

    Thanks for the help!

  10. #10
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem..

    As far as ssLinks goes, I don't know what it does or how well it does it, but Skunk has given some good replies in posts, so I figure it's gotta be good


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •