Log in

View Full Version : problem with ajax (ajaxtabscontent) and lightbox2.02 scripts



irandoct
03-09-2007, 11:27 AM
hello,
i used two DD great scripts (ajaxtabscontent & lightbox2.02) in my php site. my default page called index.php and both of these scripts work well. But when i try a new ajax tab (page.php?pid=XXX) my ajaxtabscontent script work well and the content of page.php load, but my lightbox2.02 script (photo galley) did NOT!
can i ask you guys take a look on my demo site and help me fix the issue!
http://www.kimiamedia.org
(site is in Farsi language)
Note: my default tab's related photos work well with lightbox2.02. if you click on a link in the right menu the related photos show without loading lightbox2.02 script! I can post my index.php code here!!!
Thank You
Mansour

codeexploiter
03-09-2007, 11:40 AM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

irandoct
03-09-2007, 04:56 PM
Hello,
DD means dynamicdrive.com!
and the link to that scripts are:
1- http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/
2- http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm
and my php pages source code is here:
index.php

<?php
error_reporting(E_ALL ^ E_NOTICE);
@include("header.html");
@include("config/config.php");
@require("config/functions.php");
$code = $_GET['code'];
if(empty($code)) {
$code = "HOME";
}
?>
<!-- right block -->
<div id="leftPan">
<!-- main menu area -->
<form action="" method="post" class="form1">
<h2></h2>
<ul id="maintab">
<li>
<?php
echo "<p><a href=\"#default\" rel=\"ajaxcontentarea\"><img src=\"images/top.gif\" border=\"0\"></a></li></p>";
$connection = mysql_connect($host,$usr,$pwd);
$content = mysql_db_query($db, "SELECT id, menutitle FROM table_content where code = '$code' AND main = '0' AND inmenu = '1' ORDER by position ASC", $connection);
while ($row = mysql_fetch_array($content)) {
$id = intval($row["id"]);
$menutitle = $row["menutitle"];
echo "<li><a href=\"page.php?pid=$id\" rel=\"ajaxcontentarea\" rev=\"\">$menutitle</a></li>";
}
?>
</ul>
</form>
<div id="bot">
<h3></h3>
</div>
<!-- end main menu area -->
</div>
<!-- end right block -->
<div id="rightPan">
<!-- dafult page content -->
<div id="ajaxcontentarea">
<?php
$maincontent = mysql_db_query($db, "SELECT title, text, date, edate, hit, id FROM table_content where code = '$code' AND main = '1' ORDER by position ASC", $connection);
$rownumber = mysql_num_rows($maincontent);
$row = mysql_fetch_row($maincontent);
$query = mysql_db_query($db, "update table_content set hit = $row[4]+1 where id = $row[5]", $connection);
$date = explode(" ", $row[2]);
$edate = explode(" ", $row[3]);
list($gyear, $gmonth, $gday ) = preg_split ('/-/', $date[0]);
list( $jyear, $jmonth, $jday ) = miladi_to_hejri($gyear, $gmonth, $gday);
list($egyear, $egmonth, $egday ) = preg_split ('/-/', $edate[0]);
list( $ejyear, $ejmonth, $ejday ) = miladi_to_hejri($egyear, $egmonth, $egday);
if ($rownumber >= 1){
echo "<b>$row[0]</b><br>$jday/$jmonth/$jyear | $date[1]";
echo "<br>";
echo $row[1];
echo "<br>";
echo "($row[4] $lang_hit || $lang_lastedit: $ejday/$ejmonth/$ejyear | $edate[1] )";
// main page photo
$content = mysql_db_query($db, "SELECT title, url FROM table_pgallery WHERE pid = '$row[5]'", $connection);
$photonumber = mysql_num_rows($content);
if($photonumber >=1){
echo "<br><div id=\"photos\"></div>";
while ($prow = mysql_fetch_array($content)) {
$title = $prow["title"];
$url = $prow["url"];
$mysock = getimagesize("$url");
$newsize = imageResize($mysock[0],$mysock[1], 50);
echo "&nbsp;&nbsp;<a href=\"$url\" rel=\"lightbox['$row[5]']\" title=\"$title\"><img src=\"$url\" $newsize border=\"0\"></a>";
}
}
//end main page photo
}
?>
</div>
<!-- end dafult page content -->
<script type="text/javascript">
startajaxtabs("maintab")
</script>
</div>
<!-- Start Bottom Of Page -->
<div id="bodyBottomPan">
<a href="#top"><img src="images/pagetop.gif" border="0"></a>
</div>
<!-- End Bottom Of Page -->
<?php
@include("footer.html");
?>
page.php

<?php
@include("config/config.php");
@require("config/functions.php");
$pid = $_GET['pid'];
$nid = $_GET['nid'];
//content
if ($pid){
$connection = mysql_connect($host,$usr,$pwd);
$rw = mysql_db_query($db, "SELECT title, text, date, edate, hit FROM table_content WHERE id='$pid'", $connection);
$content = mysql_db_query($db, "SELECT title, url FROM table_pgallery WHERE pid = '$pid'", $connection);
$photonumber = mysql_num_rows($content);
$row = mysql_fetch_row($rw);
$query = mysql_db_query($db, "update table_content set hit = $row[4]+1 where id='$pid'", $connection);
$date = explode(" ", $row[2]);
$edate = explode(" ", $row[3]);
list($gyear, $gmonth, $gday ) = preg_split ('/-/', $date[0]);
list( $jyear, $jmonth, $jday ) = miladi_to_hejri($gyear, $gmonth, $gday);
list($egyear, $egmonth, $egday ) = preg_split ('/-/', $edate[0]);
list( $ejyear, $ejmonth, $ejday ) = miladi_to_hejri($egyear, $egmonth, $egday);
echo "<b>$row[0]</b><br>$jday/$jmonth/$jyear | $date[1]";
echo "<br>";
echo $row[1];
echo "<br>";
echo "($row[4] $lang_hit || $lang_lastedit: $ejday/$ejmonth/$ejyear | $edate[1] || $photonumber $lang_photonum)";
//
if ($photonumber >= 1){
echo "<br><div id=\"photos\"></div>";
while ($prow = mysql_fetch_array($content)) {
$title = $prow["title"];
$url = $prow["url"];
$mysock = getimagesize("$url");
$newsize = imageResize($mysock[0],$mysock[1], 50);
echo "&nbsp;&nbsp;<a href=\"$url\" rel=\"lightbox['$pid']\" title=\"$title\"><img src=\"$url\" $newsize border=\"0\"></a>";
}
}
//
//end content
//news
}else if ($nid){
$connection = mysql_connect($host,$usr,$pwd);
$rw = mysql_db_query($db, "SELECT title, text, date, edate, hit FROM table_news WHERE id='$nid'", $connection);
$row = mysql_fetch_row($rw);
$query = mysql_db_query($db, "update table_news set hit = $row[4]+1 where id='$nid'", $connection);
$content = mysql_db_query($db, "SELECT title, url FROM table_ngallery WHERE nid = '$nid'", $connection);
$photonumber = mysql_num_rows($content);
$date = explode(" ", $row[2]);
$edate = explode(" ", $row[3]);
list($gyear, $gmonth, $gday ) = preg_split ('/-/', $date[0]);
list( $jyear, $jmonth, $jday ) = miladi_to_hejri($gyear, $gmonth, $gday);
list($egyear, $egmonth, $egday ) = preg_split ('/-/', $edate[0]);
list( $ejyear, $ejmonth, $ejday ) = miladi_to_hejri($egyear, $egmonth, $egday);
echo "<b>$row[0]</b><br>$jday/$jmonth/$jyear | $date[1]";
echo "<br>";
echo $row[1];
echo "<br>";
echo "($row[4] $lang_hit || $lang_lastedit: $ejday/$ejmonth/$ejyear | $edate[1] || $photonumber $lang_photonum)";
//
if ($photonumber >= 1){
echo "<br><div id=\"photos\"></div>";
while ($prow = mysql_fetch_array($content)) {
$title = $prow["title"];
$url = $prow["url"];
$mysock = getimagesize("$url");
$newsize = imageResize($mysock[0],$mysock[1], 50);
echo "&nbsp;&nbsp;<a href=\"$url\" rel=\"lightbox['$nid']\" title=\"$title\"><img src=\"$url\" $newsize border=\"0\"></a>";
}
}
//
}
//end news
?>


Thank You