Author Topic: Using image tags on a custom page.  (Read 66972 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #15 on: November 12, 2007, 10:52:20 PM »
I respect your decision. No problem.

I hope another PHP GURU will like it to help me in this request :cry:

@mawenzi
Please!

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Using image tags on a custom page.
« Reply #16 on: November 12, 2007, 10:53:14 PM »
On the custom template I used this tags:
...

... in this way you must edit for every {image_name_xxx} your template ... !
... and so this tags are static, not like all the other tags ... they are dynamic ...
... and so I think, you can edit the image name in the template directly instead of use php code ...
... use in your template Foto of USA instead of {image_name_550} ...
... the result is the same, but without php code ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #17 on: November 12, 2007, 11:03:54 PM »
Thank you mawenzi for your reaction.

Quote
... in this way you must edit for every {image_name_xxx} your template ... !
... and so this tags are static, not like all the other tags ... they are dynamic ...
... and so I think, you can edit the image name in the template directly instead of use php code ...
... use in your template Foto of USA instead of {image_name_550} ...
... the result is the same, but without php code ...

Of course you're right, but what about {image_hits} (That what I want to reach :wink:).
I want to use ID'S to generate the current hits of each image I have on this custom template.

For example:

Image                           Current Hits
Foto of Spain                  880
Foto of Brazil                  150

So, I need PHP!

What do you think about that?


Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #18 on: November 12, 2007, 11:07:20 PM »
Ok so you need use each image ID for this. I ask but you say no - is all image ID.

1 - Foto of Spain: 880 (one image ID)
2 - Foto of Brazil (one image ID).

Is 2 diff image ID. :?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #19 on: November 12, 2007, 11:10:11 PM »
Yes. it's different.
Please don't tell you do not like again :|

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #20 on: November 12, 2007, 11:15:41 PM »
Now ... how can set all image ID in tag if is for each image ID ? I no get ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Using image tags on a custom page.
« Reply #21 on: November 12, 2007, 11:26:38 PM »
@ cruxy

... is your list of images (I mean only the images) on your custom page static ... ?
... if no ... you can use a "additional_image_field" ... for selecting in ACP ...
... and then you can use a "right" php-code for all your tags in your list (and also for image_name) ...

... there are "image lists" (here in the forum) like e.g. "featured images", that works in this way ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #22 on: November 12, 2007, 11:46:51 PM »
@mawenzi

Quote
... is your list of images (I mean only the images) on your custom page static ... ?
Yes, they are unfortunatly static. (I think it will be a mission impossible)

Oke you give a idea and I hope you'll help me.

I wil make an image additional field:

Code: [Select]
$additional_image_fields['image_featured] = array("featured", "radio", 0);
@mawenzi
@Thunderstrike

How can I call (With tags) those featured images to use them in the custom template?
(I want only the link {image_name} to the image  (datails.php) in this list + {image_hits}) something like:

Quote
Image                           Current Hits
Foto of Spain                  880
Foto of Brazil                  150

NOTE: I want to use them on the custom page. I do not want to use Search.php.

You know now what I want to realise, so please If you a better Idea I will happy to hear it from you guys :wink:

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #23 on: November 12, 2007, 11:58:50 PM »
Quote
NOTE: I want to use them on the custom page. I do not want to use Search.php.

If want for use in custom page, you need for use $additional_field_array (see e.g in includes/functions.php file in show image function for variable).
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #24 on: November 13, 2007, 12:13:05 AM »
Good, we are now in the good way :)

But if i have 1000 featured image, then I have to add more + 3000 lines to the functions.php.

I have an idea, but I can not code it:

Listen: What about to use a variable on the functions.php ($image_name_id) and then I can change the ID on the custom page.
That means that if I use {image_name_13} 4image will understand that I am talking here about {image_name}.

Maybe in functions.php something like: $image_name_id = $image_row['image_name].$image_row['image_id]
It is just an idea (Everything in possible :wink:)

Please use your fantasy to help me!

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #25 on: November 13, 2007, 12:20:03 AM »
Quote
But if i have 1000 featured image, then I have to add more + 3000 lines to the functions.php.

Incorrect. If use $additional_image_fields and core fields, no need for add tag in includes/functions.php file.

Quote
Listen: What about to use a variable on the functions.php ($image_name_id) and then I can change the ID on the custom page.
That means that if I use {image_name_13} 4image will understand that I am talking here about {image_name}.

So - question is again - how use all image ID if details use $image_row with each image ID click ?

Quote
Maybe in functions.php something like: $image_name_id = $image_row['image_name].$image_row['image_id]

If create new array in global.php file, you use with all 4images for select images. One thing is you need for select all image. Is no for each (gallery slow if do this). Details.php is code with each select image ID from user. Is why is show one image in detail for each image ID.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #26 on: November 13, 2007, 12:24:37 AM »
Quote
So - question is again - how use all image ID if details use $image_row with each image ID click ?

I am sorry, I do not get it. What do you mean with it? Would you like to explain please?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Using image tags on a custom page.
« Reply #27 on: November 13, 2007, 12:27:26 AM »
How can I call (With tags) those featured images to use them in the custom template?

... for your custom.php ...
... I think, like this ... but it is not the complete code ! ... just for example ! ...
... fine tuning is your part ...

Code: [Select]
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_date, i.image_active, 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 i.image_featured = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
        ORDER BY i.image_date DESC
        LIMIT 20";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows)  {
   $featured_images_list = $lang['no_images'];
}
else  {
   $featured_images_list = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\"><tr><td>Image Name</td><td>Current Hits</td></tr>";
   while ($image_row = $site_db->fetch_array($result)){
   $featured_images_list .= "<tr><td>".$image_row['image_name']."</td><td>".$image_row['image_hits']."</td></tr>";
  }
}
  $featured_images .= "</table>\n";
$site_template->register_vars("featured_images_list", $featured_images_list);
unset($featured_images_list);

... design of the list is your part ...
... if there is a mistake ... thunderstrike let us know ... ;)
« Last Edit: November 13, 2007, 01:32:07 AM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #28 on: November 13, 2007, 12:28:18 AM »
Quote
I am sorry, I do not get it. What do you mean with it? Would you like to explain please?

Please see details.php file.

Look for:

Quote
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";

$image_id is mean the image ID user is click (e.g: details.php?image_id=1). After click, is show detail image of image ID 1 and no all image ID select.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #29 on: November 13, 2007, 12:29:03 AM »
Quote
WHERE i.image_active = 1 AND i.image_featured = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")

With this - is select all image ID. Is no for each image ID ...
Is mean, if IMAGES_TABLE is 2000 image (e.g for 2000) - is select 2000 image for select some image ID in tag ...  :|
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?