4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: BartAfterDark on December 23, 2006, 01:26:30 AM

Title: more random images?
Post by: BartAfterDark on December 23, 2006, 01:26:30 AM
Hi,

Is there anyway to show more random images on any page of the site?

 - Lars
Title: Re: more random images?
Post by: KurtW on December 23, 2006, 07:57:54 AM
Hi,

look here:
http://www.4homepages.de/forum/index.php?topic=4259.15 (http://www.4homepages.de/forum/index.php?topic=4259.15)

Search function from this forum is also a good way to find a answer  :wink:


cu
Kurt
Title: Re: more random images?
Post by: Sunny C. on April 08, 2010, 08:59:24 PM
Wie bewerktstelligt man das?
Ich möchte mehrere Random Images anzeigen lassen und zwar so :D

Code: [Select]
    {if random_image}
    <div id="left_outer">
      <div class="left_inner_float">
        <div class="left_inner">
          <div class="module_menu">
            <div>
              <div>
                <div>
                  <h3>Zufalls Cover</h3>
                  <ul class="menu">
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}
                    {random_image}                 
                    </ul>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    {endif random_image}

Aber es wird immer das gleiche ausgegeben, wie funktioniert das? Das jedes zufällig ausgegeben wird?
Title: Re: more random images?
Post by: Rembrandt on April 09, 2010, 07:52:20 AM
...
 und zwar so

ich verstehe jetzt nicht warum du das unbedingt so haben möchtest, viel freude wirst du damit nicht haben:

in der page_header.php suche:
$z<=5 gibt die anzahl der bilder an.


$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);

ersetzte es mit :

for ($z=0; $z<=5; $z++){
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image$z", $random_image);
unset($random_image);
}

 in der home.html kannst du jetzt {random_image1} {random_image2} {random_image..N} schreiben.
Title: Re: more random images?
Post by: batu544 on April 09, 2010, 08:08:48 AM
Rembrandt,

For me.. it returned the same image for 5 times..   

Thanks,
batu544
Title: Re: more random images?
Post by: Rembrandt on April 09, 2010, 10:33:34 AM
@batu544, forgot the code, the code is shi*t.
For me I would do it differently,pretending are nonsense.
Title: Re: more random images?
Post by: Sunny C. on April 09, 2010, 02:11:23 PM
Mein Spaß werde ich damit haben, allerdings funktioniert das aber nicht.

Der Code;
Code: [Select]
   {if random_image}
    <!-- Start Left Module -->
    <div id="left_outer">
      <div class="left_inner_float">
        <div class="left_inner">
              <div class="module_menu">
                <div>
                  <div>
                    <div>

                      <h3>Zufalls Cover</h3>
                                            <ul class="menu">
                        {random_image1}
                        {random_image2}
                        {random_image3}
                        {random_image4}
                        {random_image5}
                        {random_image6}
                        {random_image7}
                        {random_image8}
                        {random_image9}
                        {random_image10}
                        {random_image11}
                        {random_image12}
                        {random_image13}
                      </ul>
                                          </div>
                  </div>

                </div>
              </div>
           </div>
      </div>
    </div>
    <!-- Ende Left Module -->
    {endif random_image}

for ($z=0; $z<=13; $z++){
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image$z", $random_image);
unset($random_image);
}

Es werden immernoch NUR diie gleichen anbgezeigt und nicht unterschiedlich, siehe Anhang
Title: Re: more random images?
Post by: Rembrandt on April 09, 2010, 04:52:47 PM
so..
 suche in der page_header.php:

unset($category_dropdown_form);
füge darunter ein:

//######################################### Random Images Start #########################################################
$num_random_images = $config['image_cells'];

$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, 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 RAND()
        LIMIT $num_random_images ";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
    $random_images = $lang['no_random_images'];
  }
else  {
$random_images ="";
  while ($image_row = $site_db->fetch_array($result)){
   show_image($image_row);
   $random_images .= $site_template->parse_template("random_bit");
  } // end while

} // end else

$site_template->register_vars(array(
"random_images" => $random_images

));
unset($random_images);
//######################################### Random Images END #########################################################

erstell eine neue datei mit den namen "random_bit.html" und speichere sie in deinen template ordner:
Code: [Select]
{thumbnail}
<br>
<b>{image_name}</b> {if image_is_new}<sup class="new">{lang_new}</sup>{endif image_is_new} ({user_name_link})
<br>
<a href="{cat_url}">{cat_name}</a><br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />
{lightbox_button}

suche in deinTemplates/home.html :
Code: [Select]
{random_image} und ersetze es mit:
Code: [Select]
{random_images}
mfg Andi
Title: Re: more random images?
Post by: Sunny C. on April 09, 2010, 05:10:56 PM
Den ersten Code den du gepostet hast aber auch wieder rein oder?
Title: Re: more random images?
Post by: Rembrandt on April 09, 2010, 05:16:42 PM
nein, vergiss den.
die bildanzahl ist so von den wert abhängig der im ACP festgelegt ist, möchtest du anzahl der bilder ändern, ersetze (im code ganz oben):
$num_random_images = $config['image_cells'];

z.b. für 10 bilder:
$num_random_images =  10;

Title: Re: more random images?
Post by: Sunny C. on April 09, 2010, 07:22:46 PM
Achso. Gut.
Werde das nachher mal einbauen und vilen Dank bis hierher

Edit://
Funktioniert perfekt
Title: Re: more random images?
Post by: Sunny C. on April 30, 2010, 10:17:42 AM
Wenn keine Zufallsbilder vorhanden sind kommt folgender Fehler:
Notice: Undefined index: no_random_images in /www/htdocs/XXXXX/XXXXX/includes/page_header.php  on line 274
Title: Re: more random images?
Post by: Rembrandt on April 30, 2010, 07:10:07 PM

füge das mal in die lang/main.php ein:
$lang['no_random_images'] = "Keine Bilder vorhanden";
Title: Re: more random images?
Post by: Sunny C. on May 02, 2010, 09:29:18 PM
Teste ich gleich mal!
Aber sag mal, ist es auch möglich die Namen zu kürzen?
Title: Re: more random images?
Post by: GaYan on May 11, 2010, 07:33:13 AM
can i show this on Details.php ?   :roll:
Title: Re: more random images?
Post by: batu544 on May 11, 2010, 08:57:37 AM
can i show this on Details.php ?   :roll:

Yes, you can show it on detail page also... you need to use that new tag {random_images} ...



Title: Re: more random images?
Post by: GaYan on May 11, 2010, 06:52:29 PM
Thanks ,, i tried it,, it ddnt work ,, ill try it again  :wink:
Title: Re: more random images?
Post by: vitara on January 05, 2013, 12:14:30 PM
Hallo zusammen

Wie kriege ich es hin das die bilder auf einer Reihe sind und nicht untereinander?

Kannst Du mir helfen bitte?

Lg Vitara
Title: Re: more random images?
Post by: bigwave on March 07, 2021, 09:37:26 PM
Hi,  I can't seem to be able to get this going on version 1.8 :?

Any suggestions would be appreciated!!!

Thanx,

Brian
Title: Re: more random images?
Post by: nobby on March 08, 2021, 01:25:53 PM
Hello,

Nothing happens here in the forum anymore, everyone has withdrawn.

nobby
Title: Re: more random images?
Post by: Vienix on March 09, 2021, 11:41:31 AM
Not everyone, yet...

Look what he has now to play with:

https://www.maui-tropica.com/maui-tropica-gallery/nextgen/

 :lol: