Copy link to clipboard
Copied
Facing yet another problem. The solution is probably going to be very simple but so far, I haven't figured it out. This is what I'm looking for:
Say you got a newspage displaying the title, message introduction and a read more button. The table in which newsmessages are stored has got 5 columns:
As you can see, the column 'newsmessage' can be NULL because sometimes, there are short messages. What I want to know is, if the column 'newsmessage' is NULL, on the page that displays the news records, the 'read more' link should not be visible. It should only show when the column 'newsmessage' is 'not null', so has got content in it.
Thanks!
Is it really a region that you want to show or hide? I guess it could be, but DW normally likes it better when the "region" is its own table row. I don't know how many times, even when I do select the TR tag in the property inspector and apply a Show or Hide server behavior, DW still places the code inside the TR tag in the source code.
So basically, want you want to do is wrap the a tag that contains the Read More text, in an If statement. I don't have the exact syntax for you, my PHP skills ar
...
Copy link to clipboard
Copied
and we're just supposed to KNOW what server side scripting language you're using cause we know you so much. So don't bother posting the necessary details. ![]()
Copy link to clipboard
Copied
Sorry
PHP that is.
Copy link to clipboard
Copied
Can you paste in the PHP you're currently using to display the recordset? Or, are you using Dreamweaver server behaviors?
Copy link to clipboard
Copied
I am indeed using DW server behaviours which makes the code look like this:
<?php do { ?>
<p class="messagedate">Geplaatst:<?php date_default_timezone_set('Europe/Brussels');
$unixtime = strtotime($row_indexnieuws['geplaatst']); echo date("d/m/Y H:i",$unixtime); ?></p>
<h2 class="messagetitle"><?php echo $row_indexnieuws['titel']; ?></h2>
<div class="messageintro"><?php echo ($row_indexnieuws['inleiding']); ?></div>
<p class="messagemore"><a href="bericht.php?id=<?php echo $row_indexnieuws['id']; ?>">Read More</a></p>
<?php } while ($row_indexnieuws = mysql_fetch_assoc($indexnieuws)); ?>
Copy link to clipboard
Copied
Is it really a region that you want to show or hide? I guess it could be, but DW normally likes it better when the "region" is its own table row. I don't know how many times, even when I do select the TR tag in the property inspector and apply a Show or Hide server behavior, DW still places the code inside the TR tag in the source code.
So basically, want you want to do is wrap the a tag that contains the Read More text, in an If statement. I don't have the exact syntax for you, my PHP skills are still in development. Perhaps one of the other folks could help out - or if you do have a Show or Hide behavior (when recordset is empty/not empty), take a look at how that code is structured and use it as a guide. But if you're going to use Null/Not Null as your condition, make sure the field actually contains a null value.
Copy link to clipboard
Copied
Thank you, your post made me think less deeper and more simple which led me to a rather easy solution. Duplicating the recordset used to display the messages and attaching an if statement to that:
<?php $readmore=$row_news['message']; if ($readmore != NULL) { ?>
<p class="messagemore"><a href="../message.php?id=<?php echo $row_news['id']; ?>">Read More</a></p>
<?php } else {echo "";} ?>
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more