This topic is locked

How to hide empty fields?

8/3/2008 11:27:56 PM
PHPRunner General questions
N
Nelson author

Hi,

I have built a site with PHPRunner and everything on that site is working properly!

The only issue is that when users don't upload any images, the view page looks something like the image below;


The code for the pictures is:

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="";
------------------------------------------------------

and in the event..view on load the code is:

global $conn,$smarty,$strTableName;

if (@$_REQUEST["editid1"])

{

$data = db_query("select * from ".$strTableName." where

lagosID=".$_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"];

else if($rstt["Photo4"]!="")

$pic=$rstt["Photo4"];

if($pic=="")

$smarty->assign("row00firstphoto_value",htmlspecialchars("images> no_image.gif"));

else

$smarty->assign("row00firstphoto_value",htmlspecialchars(AddLinkPrefix("Photo1",$pic)));

}
------------------------------------------------------

Now I wanted to know how to hide fields when they are empty!..or how to hide this empty space behind no-image?



Thanks in advance!

Nelson

N
nix386 8/4/2008

I have no idea really but this might be something to look at.
$smarty->assign("row00firstphoto_value",htmlspecialchars("images>no_image.gif"));

also removing the width may make it look a little less odd...

Hi,

I have built a site with PHPRunner and everything on that site is working properly!

The only issue is that when users don't upload any images, the view page looks something like the image below;

The code for the pictures is:

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="";
------------------------------------------------------

and in the event..view on load the code is:

global $conn,$smarty,$strTableName;

if (@$_REQUEST["editid1"])

{

$data = db_query("select * from ".$strTableName." where

lagosID=".$_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"];

else if($rstt["Photo4"]!="")

$pic=$rstt["Photo4"];

if($pic=="")

$smarty->assign("row00firstphoto_value",htmlspecialchars("images> no_image.gif"));

else

$smarty->assign("row00firstphoto_value",htmlspecialchars(AddLinkPrefix("Photo1",$pic)));

}
------------------------------------------------------

Now I wanted to know how to hide fields when they are empty!..or how to hide this empty space behind no-image?



Thanks in advance!

Nelson

J
Jane 8/4/2008

Hi,
please make sure all uplaoded files are in the output/photo/ directory.

N
Nelson author 8/4/2008

I have no idea really but this might be something to look at.

$smarty->assign("row00firstphoto_value",htmlspecialchars("images>no_image.gif"));

also removing the width may make it look a little less odd...


Thanks for your reply!

There is a no_image-file at the images> no_image.gif
and when I change the width of the images in this code, Even the image-fields with uploaded pics Disappeared!

if (htmlspecialchars(AddLinkPrefix("Photo1",$data["vPhoto1"]))!="photos")

{

$value="<img";

$value.=" onmouseover=\"if(LoadMainPhoto != null)

LoadMainPhoto('".htmlspecialchars(AddLinkPrefix("Photo1",$data["vPhoto1"]))."');\"";

$value.=" width=0"; <------------**You meant this one ,right?**

$value.=" border=0";

$value.="

src=\"".htmlspecialchars(AddLinkPrefix("Photo1",$data["vPhoto1"]))."\">";

}

else

$value="";
Have a nice day!

Nelson

N
Nelson author 8/4/2008

Hi,

please make sure all uplaoded files are in the output/photo/ directory.


Hi Jane!

How are you?

Well,

The problem which I'm experiencing is not when they upload images...it's when they don't upload any images, then the view page looks like this;


And I checked the add page photo-fields and they seems to be correct for the uploaded directory;
Add page(in the view as)


Add page(in the edit as)

J
Jane 8/4/2008

Nelson,
we use following code in the "View as" settings dialog --> Custom to hide empty images:

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="";

N
Nelson author 8/4/2008

Nelson,

we use following code in the "View as" settings dialog --> Custom to hide empty images:


Greetings Jane,

Your code and mine looks identical...why you think I still get the wide empty spaces in the 'view page'?

J
Jane 8/4/2008

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

N
Nelson author 8/5/2008

Hi Jane!
I received your e-mail...after the changes I made by your instructions....everything is working perfectly at the site!
Have a great day!

Nelson