N
|
Nelson 1/8/2010 |
This is how I did it way back when; |
A
|
ashojai author 1/14/2010 |
I worked beautifully, the explanation was very precise! Thanks a Lot Nelson, Arian This is how I did it way back when; 1# I created a table with fields: ID,Photo1,Photo2;Photo3. (Primery Key =ID) 2# In SQL query I created SELECT ID, Photo1, Photo2, Photo3, Photo1 AS vPhoto1, Photo2 AS vPhoto2, Photo3 AS vPhoto3 FROM _TableName 3# In visual Editor(add page) I wrote 'photos' in the upload folder for the field 'Photo1' as did I for Photo2,Photo3 in the 'edith as' and the view as I wrote image width:160 image hight:120 URL prefix:photos/ for all three pic fields! 4# In the Visual Editor(View page) I past this code(in custom mode) to each of the vPhoto fields: if (htmlspecialchars(AddLinkPrefix("Photo1",$data["vPhoto1"]))!="photos/") { $value="<img"; $value.=" onmouseover=\"if(LoadMainPhoto != null) LoadMainPhoto('".htmlspecialchars(AddLinkPrefix("Photo1",$data["vPhoto1"]))."');\""; $value.=" width=150"; $value.=" border=0"; $value.=" src=\"".htmlspecialchars(AddLinkPrefix("Photo1",$data["vPhoto1"]))."\">"; } else $value=""; I changed the number of the Photos depending on the field name...in the field:vPhoto2 all the Photo1's in the code above become Photo2 or vPhoto2 5# Then I inserted this code which should show the bigger picture of them 3 Photos...when the mouse goes over them ,Put the codes below in the 'view page' <TD vAlign=top rowSpan=40><IMG id=imgMainPhoto src="http://www.yoursite.com/Tablesname/{$row00firstphoto_value}"></TD> 6# and in the inserted the custom made code in the 'view on load' in the Events: global $conn,$smarty,$strTableName; if (@$_REQUEST["editid1"]) { $data = db_query("select * from ".$strTableName." where ID=".$_REQUEST["editid1"],$conn); $rstt = db_fetch_array($data); $pic=""; if($rstt["Photo1"]!="") $pic=$rstt["Photo1"]; else if($rstt["Photo2"]!="") $pic=$rstt["Photo2"]; else if($rstt["Photo3"]!="") $pic=$rstt["Photo3"]; if($pic=="") $smarty->assign("row00firstphoto_value",htmlspecialchars("images> no_image.gif")); else $smarty->assign("row00firstphoto_value",htmlspecialchars(AddLinkPrefix("Photo1",$pic))); } 7# and last not least : put this code just before </BODY> in the view page {literal} <script> var _imgMainPhoto = document.getElementById("imgMainPhoto"); function LoadMainPhoto(photoUrl) { _imgMainPhoto.src = photoUrl; } </script> {/literal} |
A
|
ashojai author 1/30/2010 |
Dear Nelson, |
N
|
Nelson 1/31/2010 |
Dear Nelson, As I mentioned before, this code really helped me. I just have one more question about this : Following your instructions, the mouse over image works perfectly in view page. However I need to point at one of the images to start the Bigger Span. In other terms , the function does not load the first image by default which is what I want and which is what the real estate template does too. I was playing a bit with the code and I noticed src="http://www.yoursite.com/Tablesname/{$row00firstphoto_value}"></TD> this line of the code does not do anything. Even when I remove it nothing happens. Do you have any idea how I can load a default picture by any chance? Thanks again. 6# and in the inserted the custom made code in the 'view on load' in the Events: global $conn,$smarty,$strTableName; if (@$_REQUEST["editid1"]) { $data = db_query("select * from ".$strTableName." where ID=".$_REQUEST["editid1"],$conn); $rstt = db_fetch_array($data); $pic=""; if($rstt["Photo1"]!="") $pic=$rstt["Photo1"]; else if($rstt["Photo2"]!="") $pic=$rstt["Photo2"]; else if($rstt["Photo3"]!="") $pic=$rstt["Photo3"]; if($pic=="") $smarty->assign("row00firstphoto_value",htmlspecialchars("images> no_image.gif")); else $smarty->assign("row00firstphoto_value",htmlspecialchars(AddLinkPrefix("Photo1",$pic))); }
if($pic=="")
<TD><IMG id=imgMainPhoto src="http://www.yoursite.net/TablesName/{$row00firstphoto_value}"></TD> |
A
|
ashojai author 2/2/2010 |
No Unfortunately it still does not work! |
N
|
Nelson 2/2/2010 |
could you post your codes(all of em)...I may find the missing part! |