TinyPortal

Development => Support => Topic started by: domeen on May 11, 2007, 01:20:45 PM

Title: New block
Post by: domeen on May 11, 2007, 01:20:45 PM
Hi,

I want to make a block on the left of my site, with the following code:

Only I don not get the right information into this block, I have selected, php block..... The code will show the lsat 10 links out of a database, and people can  add a new link...

Can somebody help me with this?


<?
$host          = "XXX";
$user          = "XXX";
$pass          = "XXX";
$database      = "XXX";

$conn          = @mysql_connect($host, $user, $pass);

if (!$conn) {
  echo "Timeout detected.....<BR><BR>Please try again by pressing F5";
  exit;
}
@mysql_select_db($database, $conn);



$sql = "SELECT "
. " lnk_name "
. ", lnk_url "
. "FROM "
. " link "
. "ORDER BY "
. " lnk_id DESC "
. "LIMIT 0,10";

$result = mysql_query($sql, $conn);


?>


<SCRIPT LANGUAGE="JavaScript">
function PopUp(URL) {
PopUp = window.open(URL, 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
}
</SCRIPT>


<html>

<div class="windowbg" >

<?

while($row = mysql_fetch_array($result)) {

?>
<span class="smalltext"><a href="<?=$row['lnk_url']?>" target="_blank"><?=$row['lnk_name']?></a></span><BR>

<?
}
?>




<BR>
<span class="smalltext"><a href="#" onClick="window.open('/linksys/link_new.php', 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no')"><font color="red">Link toevoegen</font></a></span>


</div>

</html>
Title: Re: New block
Post by: Zetan on May 11, 2007, 01:26:43 PM
Try it in a Script Block... It seems to work for me, I just get one red link:
Link toevoegen
Title: Re: New block
Post by: domeen on May 11, 2007, 02:39:54 PM
yeah, that's not correct, you also must see 10 links within that block and at the bottom, Link toevoegen
Title: Re: New block
Post by: tick on May 11, 2007, 02:42:46 PM
If you are using it in a php block try removing the <? at the top.   
Title: Re: New block
Post by: domeen on May 11, 2007, 02:48:13 PM
only <?

if have tried doesn't work... :(
Title: Re: New block
Post by: tick on May 11, 2007, 03:02:19 PM
Well just give it some time and one of the coders will see and probably have a fix for it.  :)
Title: Re: New block
Post by: domeen on May 11, 2007, 03:12:27 PM
click the link:

http://www.domeen.nl/linksys/links.php

that's the result I want to have in a block
Title: Re: New block
Post by: Zetan on May 11, 2007, 03:33:03 PM
Put all of this in a HTML Block:

<div class="tborder"><span class="smalltext"><a href="http://www.rijnhafen.nl" target="_blank">Rijnhafen.nl</a></span><BR><span class="smalltext"><a href="http://www.leukisanders.com" target="_blank">Leukisanders</a></span><BR><span class="smalltext"><a href="http://www.terra-mode.nl" target="_blank">Terra mode</a></span><BR><span class="smalltext"><a href="http://www.livesex.nl" target="_blank">Live Sex .nl</a></span><BR><span class="smalltext"><a href="http://www.cammiegirls.nl" target="_blank">CammieGirls</a></span><BR><span class="smalltext"><a href="http://www.imagebarn.net" target="_blank">ImageBarn.net</a></span><BR><span class="smalltext"><a href="http://www.tastelikepizza.com" target="_blank">Tastelikepizza</a></span><BR><span class="smalltext"><a href="http://www.vraagnaardevoorwaarden.nl/" target="_blank">vndv.nl</a></span><BR><span class="smalltext"><a href="http://www.domeen.nl/index.php?topic=3985.msg63777;topicseen#msg63777" target="_blank">Tara en Borgje Topic</a></span><BR><span class="smalltext"><a href="http://www.badmofo.nl" target="_blank">Badmofo</a></span><BR><BR>
<span class="smalltext"><a href="#" onClick="window.open('/linksys/link_new.php', 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no')"><font color="red">Link toevoegen</font></a></span></div></html></div></html>
      
Title: Re: New block
Post by: jacortina on May 11, 2007, 03:43:13 PM
I believe that getting the links (the most recent 10) from a database was a consideration.

How about (in script block):
<SCRIPT LANGUAGE="JavaScript">
function PopUp(URL) {
PopUp = window.open(URL, 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
}
</SCRIPT>

<div class="windowbg" >

<?php
$host          
"XXX";
$user          "XXX";
$pass          "XXX";
$database      "XXX";

$conn          = @mysql_connect($host$user$pass);

if (!
$conn) {
  echo 
"Timeout detected.....<BR><BR>Please try again by pressing F5";
  exit;
}
@
mysql_select_db($database$conn);



$sql = "SELECT "
. " lnk_name "
. ", lnk_url "
. "FROM "
. " link "
. "ORDER BY "
. " lnk_id DESC "
. "LIMIT 0,10";

$result  mysql_query($sql$conn);

while(
$row mysql_fetch_array($result)) {
echo '<span class="smalltext"><a href="'$row['lnk_url'], '"target="_blank">'$row['lnk_name'], '</a></span><BR>';
}
?>


<BR>
<span class="smalltext"><a href="#" onClick="window.open('/linksys/link_new.php', 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no')"><font color="red">Link toevoegen</font></a></span>

</div>


Title: Re: New block
Post by: domeen on May 11, 2007, 04:00:40 PM
nop :( I don't get the results out of the database....
Title: Re: New block
Post by: jacortina on May 11, 2007, 04:21:06 PM
Does anything show in your forum Error Log?

Am I right in saying the it DOES NOT display the 'Timeout detected...' message?

Does the bottom link 'Link toevoegen' show up?
Title: Re: New block
Post by: domeen on May 11, 2007, 04:23:24 PM
It show nothing except "link toevoegen"

the forum error log is still empy, no errors
Title: Re: New block
Post by: domeen on May 11, 2007, 05:17:22 PM
if I delete all the scipt codes, and put it in a php box, then the results are shown in the block, so it's in the script code I think...