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/off functionality. For example:
- Title
- Text
- Readmore
- Date
- Author
or just
- Readmore
- Title
I’m thinking of this code, but I believe there’s a better solution?
<div id="pos1">
<?php
if ( show = 1 ) {
echo 'Here will be title';
elseif ( show = 2 ) {
echo 'Here will be text';
elseif ( show = 3 ) {
echo 'Here will be readmore';
.....
else { $string = 'nothing here'; }
?></div>
<div id="pos2">
<?php
if ( showsecond = 1 ) {
echo 'Here will be title';
elseif ( showsecond = 2 ) {
echo 'Here will be text';
elseif ( showsecond = 3 ) {
echo 'Here will be readmore';
.....
else { $string = 'nothing here'; }
?></div>
You could do something like this:
Edit: