help check if file exist and repond accordingly

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JD

    help check if file exist and repond accordingly

    What im trying to do is something like this maybe in my profile.php file


    //site thumbnail check////////////
    $filename = "sitethumbs/".$user['login'].".jpg";
    if (file_exists($f ilename)) {
    } else {
    $t->assign('siteth umbs', $filename);
    }
    /////end////////////



    then I have a file called viewprofile.htm l which uses the profile.php with
    smarty templates so in this file I use


    {if ($sitethumbs)}
    <img src="members/sitethumbs/thumbs/{$user.login}.j pg" border="0"
    width="145" alt="Visit {$user.login}'s website">
    {/if}



    Basicly in the template file it is always showing ($sitethumbs)


  • Mike Willbanks

    #2
    Re: help check if file exist and repond accordingly

    JD wrote:[color=blue]
    > What im trying to do is something like this maybe in my profile.php file
    >
    >
    > //site thumbnail check////////////
    > $filename = "sitethumbs/".$user['login'].".jpg";
    > if (file_exists($f ilename)) {
    > } else {
    > $t->assign('siteth umbs', $filename);
    > }
    > /////end////////////[/color]

    I think you are doing it unexpectedly... you are asking for the
    sitethumbs to be set when the file does not exist? Shouldn't it be the
    otherway around?

    [color=blue]
    > then I have a file called viewprofile.htm l which uses the profile.php with
    > smarty templates so in this file I use
    >
    >
    > {if ($sitethumbs)}
    > <img src="members/sitethumbs/thumbs/{$user.login}.j pg" border="0"
    > width="145" alt="Visit {$user.login}'s website">
    > {/if}
    >
    >
    >
    > Basicly in the template file it is always showing ($sitethumbs)
    >
    >[/color]

    Comment

    • JD

      #3
      Re: help check if file exist and repond accordingly

      I want it set if the sitethumbs exist, just don't know the proper way to do
      it

      "Mike Willbanks" <pencap@gmail.c om> wrote in message
      news:LKYye.3132 $x82.2004@fe03. lga...[color=blue]
      > JD wrote:[color=green]
      >> What im trying to do is something like this maybe in my profile.php file
      >>
      >>
      >> //site thumbnail check////////////
      >> $filename = "sitethumbs/".$user['login'].".jpg";
      >> if (file_exists($f ilename)) {
      >> } else {
      >> $t->assign('siteth umbs', $filename);
      >> }
      >> /////end////////////[/color]
      >
      > I think you are doing it unexpectedly... you are asking for the sitethumbs
      > to be set when the file does not exist? Shouldn't it be the otherway
      > around?
      >
      >[color=green]
      >> then I have a file called viewprofile.htm l which uses the profile.php
      >> with
      >> smarty templates so in this file I use
      >>
      >>
      >> {if ($sitethumbs)}
      >> <img src="members/sitethumbs/thumbs/{$user.login}.j pg" border="0"
      >> width="145" alt="Visit {$user.login}'s website">
      >> {/if}
      >>
      >>
      >>
      >> Basicly in the template file it is always showing ($sitethumbs)[/color][/color]


      Comment

      Working...