Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

swap image within repeat region

Guest
Jun 26, 2006 Jun 26, 2006
I'm trying to setup a swap image behaviour from within a repeat region dataset using php/mysql model. Anyone help? Cheers.
TOPICS
Server side applications
778
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jun 27, 2006 Jun 27, 2006
Thanks Rob, that's done it. Working code below.

<?php $i=1 //setup the dynamic ID number;
do { ?>
<a href="details.php?productCat=<?php echo $row_productCategory_rs['id_productCategory']; ?>&productID=<?php echo $row_productGroups_rs['id_product']; ?>" onmouseover="MM_swapImage('productImage','<?php $i; //add dynamic ID number here to make unique ?>','images/<?php echo ($row_productGroups_rs['image_product'])?>',1)" onmouseout="MM_swapImgRestore()"><?php echo $row_productGroups_rs['name_produc...
Translate
LEGEND ,
Jun 26, 2006 Jun 26, 2006
You will have to have the image paths in columns in the database and then in
the Swap Image behavior, use the data source param rather than the name of
an image. Haven't tried this in PHP but it should work.


--
Nancy Gill
Adobe Community Expert
BLOG: http://www.dmxwishes.com/blog.asp
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner's
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development


"pattam_" <webforumsuser@macromedia.com> wrote in message
news:e7ovhh$jjd$1@forums.macromedia.com...
> I'm trying to setup a swap image behaviour from within a repeat region
> dataset using php/mysql model. Anyone help? Cheers.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 26, 2006 Jun 26, 2006
Yep have set that all up and the logic makes sense but it's not swapping the image. I suspect that this tech note has the answer but it doesn't refer to the php/mysql model so I can't follow it:

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16510

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 26, 2006 Jun 26, 2006
And I have to leave for a client appointment. I'll check back when I return
and if you haven't solved it, I'll have a look at it.


--
Nancy Gill
Adobe Community Expert
BLOG: http://www.dmxwishes.com/blog.asp
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner's
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development


"pattam_" <webforumsuser@macromedia.com> wrote in message
news:e7p0kp$ks5$1@forums.macromedia.com...
> Yep have set that all up and the logic makes sense but it's not swapping
> the
> image. I suspect that this tech note has the answer but it doesn't refer
> to
> the php/mysql model so I can't follow it:
>
> http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16510
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 26, 2006 Jun 26, 2006
Thanks I apprecieate it.....I'm not going to solve this one on my own!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2006 Jun 27, 2006
You need to make sure that each image ID is unique in the repeating region
for the swap image to know which image to swap.
To do this, simply add a dynamic ID number (from the data being repeated in
the repeat region) to the end of the image ID value.

HTH
Rob
http://robgt.com/ [Tutorials and Extensions]
Firebox stuff: http://robgt.com/firebox
Skype stuff: http://robgt.com/skype
Dell stuff: http://robgt.com/dell
SatNav stuff: http://robgt.com/satnav



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2006 Jun 27, 2006
Thanks Rob, that's done it. Working code below.

<?php $i=1 //setup the dynamic ID number;
do { ?>
<a href="details.php?productCat=<?php echo $row_productCategory_rs['id_productCategory']; ?>&productID=<?php echo $row_productGroups_rs['id_product']; ?>" onmouseover="MM_swapImage('productImage','<?php $i; //add dynamic ID number here to make unique ?>','images/<?php echo ($row_productGroups_rs['image_product'])?>',1)" onmouseout="MM_swapImgRestore()"><?php echo $row_productGroups_rs['name_product']; ?></a><br />
<?php $i++; //increment the dynamic ID number } while ($row_productGroups_rs = mysql_fetch_assoc($productGroups_rs)); ?>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2006 Jun 27, 2006
All working fine with the code above....but has anyone got a solution for preloading those images?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 28, 2006 Jun 28, 2006
I wouldn't worry about it really - but if you definitely must do it, my
suggestion would be to basically duplicate the repeat region code above the
code for the page (above the HTML tag) in order to loop through those items
that will appear in the main repeat region.
When looping through them, you would build a comma separated string of image
names that you could then dynamically add to the (existing?) preload call on
the BODY tag.

I'd offer up sample code but I don't do PHP :(

I hope that helps a little.
Cheers,
Rob
http://robgt.com/ [Tutorials and Extensions]
Firebox stuff: http://robgt.com/firebox
Skype stuff: http://robgt.com/skype
Dell stuff: http://robgt.com/dell
SatNav stuff: http://robgt.com/satnav



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2006 Jun 28, 2006
I think I may have found a way around it. I simply load each swap image in during the loop as a 1x1pixel and therefore its loaded into the page and is ready to swap when needed. It seems to work...anyone care to disagree?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2006 Jun 29, 2006
>load each swap image in during the loop as a 1x1pixel and therefore its
>loaded into the page and is ready to swap when needed

That would work too :)
Nice idea!

Cheers,
Rob
http://robgt.com/ [Tutorials and Extensions]
Firebox stuff: http://robgt.com/firebox
Skype stuff: http://robgt.com/skype
Dell stuff: http://robgt.com/dell
SatNav stuff: http://robgt.com/satnav



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 29, 2006 Jun 29, 2006
....almost. Just viewed the site on a lower resolution monitor and the 1x1pixel is still visible as a faint dot. Can't think of a way to disguise it. I'll give your method a crack but can't get to it for a week.

Stay tuned.....
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2006 Jun 29, 2006
LATEST
Another thought I just had was that your method will add to the download
time slightly due to the images being "preloaded" but also resized to 1x1
pixel...

I don't know how much extra time it will take though, probably minimal to be
honest.

You could apply a class (CSS) to the 1x1 image to simply not display it at
all.

Cheers,
Rob
http://robgt.com/ [Tutorials and Extensions]
Firebox stuff: http://robgt.com/firebox
Skype stuff: http://robgt.com/skype
Dell stuff: http://robgt.com/dell
SatNav stuff: http://robgt.com/satnav



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines