Line breaks in PHP

I am trying to create a database-driven newsroom in Freeway and am encountering two challenges:

  1. I would like to style the text. I’ve placed php code in html markup items on a text box and formatted all the content in the text box as Helvetica 12 pt. but the text comes out unstyled.

  2. I would like to have line breaks between the items but am unable to do that either by inserting
    , n or rn.

Here’s the markup code in 2 html markup items in the text box:

markup item 1:

<?php $news = getAllByType('news',array('year'=>'All','limit'=>4)); ?>

markup item 2:

<?php showRows($news); echo "
"; ?>

Any suggestions? Thanks in advance.

Thanks,

http://www.blue-iceberg.com/dbtest/pressroom.php


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

On 23 Apr 2018, at 18:07, Richard Cacciato wrote:

I am trying to create a database-driven newsroom in Freeway and am
encountering two challenges:

  1. I would like to style the text. I’ve placed php code in html markup
    items on a text box and formatted all the content in the text box as
    Helvetica 12 pt. but the text comes out unstyled.

  2. I would like to have line breaks between the items but am unable to
    do that either by inserting
    , n or rn.

Here’s the markup code in 2 html markup items in the text box:

markup item 1:

<?php $news = getAllByType('news',array('year'=>'All','limit'=>4)); ?>

markup item 2:

<?php showRows($news); echo "
"; ?>

Any suggestions? Thanks in advance.

Presumably (what is, in effect)
showRows(getAllByType(‘news’,array(‘year’=>‘All’,‘limit’=>4)))
shows multiple rows of news. For the browser to put a line break
in-between items you need to put a ‘
’ between them. Have you
tried putting a ‘
’ on the end of each news item as it is stored
in the database?

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Unfortunately I can’t do that because the database powers something else.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

On 23 Apr 2018, at 21:26, Richard Cacciato wrote:

Unfortunately I can’t do that because the database powers something
else.

In that case you need to find a way to get the news items on-by-one,
loop through them, and include to output of a ‘
’ within the
loop after each one.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

To style text that you are inserting from a markup item, try putting a space before and after the markup item, and then select the entire space/markup item/space sandwich as one line of text. With that selected, apply your style. Markup items all by themselves on a line do not get any styling applied to themselves.

As far as the loop goes, you’re going to need to break the function down to something that can show one line, rather than all rows. So imagine that you have such a function called showLine($record) you could do this:

<?php
foreach(getAllByType('news, array('year'=>'All','limit'=>4)) as $line){
?>

and then

[space with style]<?= showLine($line) ?>[shift-return (to make a line-break)]
[space with style]

followed by

<?php } ?>

Walter

On Apr 23, 2018, at 1:07 PM, Richard Cacciato email@hidden wrote:

I am trying to create a database-driven newsroom in Freeway and am encountering two challenges:

  1. I would like to style the text. I’ve placed php code in html markup items on a text box and formatted all the content in the text box as Helvetica 12 pt. but the text comes out unstyled.

  2. I would like to have line breaks between the items but am unable to do that either by inserting
    , n or rn.

Here’s the markup code in 2 html markup items in the text box:

markup item 1:

<?php $news = getAllByType('news',array('year'=>'All','limit'=>4)); ?>

markup item 2:

<?php showRows($news); echo "
"; ?>

Any suggestions? Thanks in advance.

Thanks,

http://www.blue-iceberg.com/dbtest/pressroom.php


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options