Author Topic: Need you help  (Read 7597 times)

0 Members and 1 Guest are viewing this topic.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Need you help
« on: January 30, 2010, 10:18:02 PM »
Hi, i have this code:

Quote
//#################################### Start Random Slide Show #################################################

$sql = "SELECT image_id, cat_id, user_id, image_name, image_media_file
        FROM ".IMAGES_TABLE."
        WHERE image_active = 1 AND cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.jpg'
        ORDER BY RAND()
        LIMIT 30";
        $result = $site_db->query($sql);
     $minis = "";
 while($row = $site_db->fetch_array($result))
   {
     $minis .= "[\"./".THUMB_DIR."/".$row['cat_id']."/".$row['image_media_file']."\",";
     $minis .= "\"".$script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id']."\",\"\"";
  //$minis .= ",\"".$row['image_name']."\"";
     $minis .= "],";
   }
     $minis = substr($minis, 0, -1);
     $max_width = $config['max_thumb_width'];
     $max_hight = $config['max_thumb_height'];
     $minislide ="
    <script type=\"text/javascript\">
     var mygallery=new fadeSlideShow({
      wrapperid: \"fadeshow\",
      dimensions: [$max_width, $max_hight],
      imagearray: [$minis],
      displaymode: {type:'auto', pause:1000, cycles:0, wraparound:true},
      fadeduration: 600,
      togglerid: \"fadeshowtoggler\"
     })
    </script>";
$minislide .= "<div class=\"head1\">";
$minislide .= "<span style=\"line-height:20px;vertical-align:middle;margin-left:3px;\">".$lang['random_image']."</span>";
$minislide .= "</div>";
$minislide .= "<div style=\"width:$max_width px;background-color:#e1e1e1\">";
$minislide .= "<div id=\"fadeshow\" style=\"margin-top:3px;\"></div>";
$minislide .= "<div id=\"fadeshowtoggler\" style=\"width:$max_width px;\">";

$minislide .= "</div>";
$minislide .= "</div>";
$site_template->register_vars("minislide", $minislide);
//#################################### End Random Slide Show #################################################

When i change my language, minislide MOD, not to add prefix in the end of link... i.e. &l=english or other

What i need to change to realize my need???

Thanks!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Need you help
« Reply #1 on: January 30, 2010, 10:37:50 PM »
Replace
     $minis .= "\"".$script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id']."\",\"\"";


with:
     $minis .= "\"".$site_sess->url($script_url."/details.php?".URL_IMAGE_ID."=".$row['image_id'])."\",\"\"";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: Need you help
« Reply #2 on: January 31, 2010, 10:24:04 AM »
Thanks so much! It`s work done!

And please help me for this. What i need to replace?

Code: [Select]
$user_images_link = "<a href=\"search.php?search_user=".$user_name."\">".$lang['more_photos_link']."</a>";

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Need you help
« Reply #3 on: January 31, 2010, 06:43:34 PM »
$user_images_link "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_user=".$user_name)."\">".$lang['more_photos_link']."</a>";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: Need you help
« Reply #4 on: February 01, 2010, 06:14:17 PM »
Another queston:

I have this code in my index.php. What i need to change, that to sort new pictures by reviews. I need this only for home.html. On another pages i`m sorting it by dates of add and configure it from ACP.

Code: [Select]
//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "has_rss"   => true,
  "rss_title" => "RSS Feed: ".format_text($config['site_name'], 2)." (".str_replace(':', '', $lang['new_images']).")",
  "rss_url"   => $script_url."/rss.php?action=images"
));

$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

$num_new_images = 2;
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN (".USERS_TABLE." u) ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images .= $lang['no_new_images'];
  $new_images .= "</td></tr></table>";
}
else  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 1 == 0) ? 1 : 1;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("random_images");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images .= "</tr>\n";
    }
  }
  $new_images .= "</table>\n";
} // end else

$site_template->register_vars("new_images", $new_images);
unset($new_images);

THANKS

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: Need you help
« Reply #5 on: February 12, 2010, 05:20:05 PM »
Another simple question,

Search form change language back when i`m searching. How to do search with &l=english prefix?