Jump to content

placeholder text


closer12
 Share

Recommended Posts

Hi, i am new on processwire.

I have a field name is "price" ..

and i want to show this field in the template if price is written,

but if not i want to display text " plase ask "  ...

I filled placeholder text but it doesnt display. 

this is very simple but i dont know php , can you help me? 

Link to comment
Share on other sites

It is just a HTML5 placeholder attribute. It just shows text in a field until the field is focused. See it as a helper for editors (who are smart enough to use a modern browser)

For the PHP part, an if statement like this will work.



if ($page->price) {
echo $page->price;
} else {
echo 'Please ask....';
}

  • Like 1
Link to comment
Share on other sites

I tried with this  ( pages  field ) when its selected ok but when not selected it didnt work , do i make something wrong? 

                if ($page->hotelisim) {
				        
					foreach($page->hotelisim as $isim)
					    echo "<tr>";
						echo "<td>{$isim->title}</td>";
						
						   foreach($isim->children as $kucuk) 
						echo "<td><li><a href='{$kucuk->url}' target='_blank'>{$kucuk->title}</a></li></td>";
						echo "<td>{$isim->hotelclass}</td>";
						echo "</tr>";
						}
				else { echo 'Please ask'; }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...