Author Topic: more random images?  (Read 26341 times)

0 Members and 1 Guest are viewing this topic.

Offline BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
more random images?
« on: December 23, 2006, 01:26:30 AM »
Hi,

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

 - Lars

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: more random images?
« Reply #1 on: December 23, 2006, 07:57:54 AM »
Hi,

look here:
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

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: more random images?
« Reply #2 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?

Rembrandt

  • Guest
Re: more random images?
« Reply #3 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.

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: more random images?
« Reply #4 on: April 09, 2010, 08:08:48 AM »
Rembrandt,

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

Thanks,
batu544

Rembrandt

  • Guest
Re: more random images?
« Reply #5 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.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: more random images?
« Reply #6 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

Rembrandt

  • Guest
Re: more random images?
« Reply #7 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
« Last Edit: April 09, 2010, 06:39:16 PM by Rembrandt »

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: more random images?
« Reply #8 on: April 09, 2010, 05:10:56 PM »
Den ersten Code den du gepostet hast aber auch wieder rein oder?

Rembrandt

  • Guest
Re: more random images?
« Reply #9 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;


Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: more random images?
« Reply #10 on: April 09, 2010, 07:22:46 PM »
Achso. Gut.
Werde das nachher mal einbauen und vilen Dank bis hierher

Edit://
Funktioniert perfekt
« Last Edit: April 10, 2010, 09:56:22 AM by Sumale.nin »

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: more random images?
« Reply #11 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

Rembrandt

  • Guest
Re: more random images?
« Reply #12 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";

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: more random images?
« Reply #13 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?

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: more random images?
« Reply #14 on: May 11, 2010, 07:33:13 AM »
can i show this on Details.php ?   :roll:
I'm Back :)