Skip to content Skip to sidebar Skip to footer

Displaying Strings In Different Ways

I'm creating a module for news display. I'd like to know if there's a better way to display info of my article. I want to be able to display info parts in different ways, with on/o

Solution 1:

You could do something like this:

$info = array(
    1 => 'This will be the title',
    2 => 'this will be the text',
    3 => 'This is the readmore',
    4 => 'Date',
    5 => 'Author'
);

echo$info[$show];

Edit:

$info = array(
    1 => array(
        'text' => 'This will be the title',
        'styles' => 'styling info goes here'
    ),
    2 => array(
        'text' => 'This will be the author',
        'styles' => 'styling info goes here'
    ),
    3 => array(
        'text' => 'This will be the date',
        'styles' => 'styling info goes here'
    )
);

echo$info[$show]['text'];

Post a Comment for "Displaying Strings In Different Ways"