Link to home
Start Free TrialLog in
Avatar of jimmylew52
jimmylew52Flag for United States of America

asked on

Make two lines of php print one line..

I have a snippet of PHP code that does what I want except it prints on two lines instead of one. It is necessary for it to print on one line. PHP 5.3. any suggestions on how to accomplish this?


<div id="footer" class="c-b">
      <div class="footer-inner">
        <?php if ($page['footer']): print render($page['footer']); endif; ?>
        <div class="c-b"></div>
      </div>
      <div id="footer-message">
        <div class="footer-inner">
              <div id="footer"> &copy 2012. All Rights Reserved. <?php print $footer_message . $footer ?></div>
              <a href="http://premiumcmsthemes.com" target="_blank" class="pt_logo"></a>
          <?php print $feed_icons; ?>
        </div>
      </div> <!-- /footer-message -->
    </div> <!-- /footer -->
Avatar of kaufmed
kaufmed
Flag of United States of America image

To which "lines" are you referring? Anything contained within a <div> is going to be on its own line by default because <div> automatically gets a new line beneath it when rendered to the screen. This is because it is a block element. If you change the display property to inline or inline-block, then you can override this default behavior.

Is it the <div>s you are referring to?
Avatar of jimmylew52

ASKER

These two lines need to print as one.

 <div id="footer"> &copy 2012. All Rights Reserved. <?php print $footer_message . $footer ?></div>
              <a href="http://premiumcmsthemes.com" target="_blank" class="pt_logo"></a>
          <?php print $feed_icons; ?>

Tried changing to

 <div id="footer"> &copy 2012. All Rights Reserved.</div> <?php print $footer_message . $footer ?>
              <a href="http://premiumcmsthemes.com" target="_blank" class="pt_logo"></a>
          <?php print $feed_icons; ?>

but got the same result.
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Looked like <a pr <span might work but they did not. I guess I do not understand.
I don't know if this is helpful but this is your code without styling or other items of code
<!doctype html>
<html>
<head>
<title>Test</title>
</head>
<body>
<?php
$page = array('footer' => 'Some footer text goes here');
$footer = "Some footer text goes here";
$footer_message = "Some additional footer text goes here";
?>
<div id="footer" class="c-b">
  <div class="footer-inner">
<?php if ($page['footer']): print $page['footer']; endif; ?>
    <div class="c-b"></div>
</div>
    <div id="footer-message">
      <div class="footer-inner">
        <div id="footer"> &copy 2012. All Rights Reserved. <?php print $footer_message . $footer ?></div>
        <a href="http://premiumcmsthemes.com" target="_blank" class="pt_logo"></a>
      </div>
    </div> <!-- /footer-message -->
</div> <!-- /footer -->
</body>
</html>

Open in new window

Which produces the following output
 Some footer text goes here
© 2012. All Rights Reserved. Some additional footer text goes hereSome footer text goes here

Open in new window

If this is not what you want then you have to look at the structure of your text. Maybe post back
a) What you are getting
b) What you would like
Avatar of fourck
fourck

If thesolution provided by Julian does not work, you should verify the values of ($footer_message and  $footer) that does not contain inside some <div> or <p> tags  .....

i suggest to post the footer output that you are getting (view source) to be able to help you in a better way.

Good Luck!
How about
 <div id="footer"><?php print "&copy 2012. All Rights Reserved.".$footer_message . $footer ?></div>
              <a href="http://premiumcmsthemes.com" target="_blank" class="pt_logo"></a>
          <?php print $feed_icons; ?>

Open in new window

Here is the HTML  and the out put on the web site.

<html class="js" dir="ltr" version="XHTML+RDFa 1.0" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/1999/xhtml/vocab">
<body class="html front not-logged-in two-sidebars page-node">
<div id="skip-link">
<div id="header">
<div id="front-page-wrapper">
<div id="page">
<div id="footer" class="c-b">
<div class="footer-inner">
<div id="footer-message">
<div class="footer-inner">
<div id="footer">© Systrends 2012. All Rights Reserved.  </div>
<a class="pt_logo" target="_blank" href="http://premiumcmsthemes.com"></a>
<a class="feed-icon" title="Subscribe to www.systrends.com RSS" href="/?q=rss.xml">
</div>
</div>
</div>
</body>
</html>
webpage.doc
Ok that outputs
© Systrends 2012. All Rights Reserved. 

Open in new window

What do you want it to output?
NB your last anchor is not closed
<a class="feed-icon" title="Subscribe to www.systrends.com RSS" href="/?q=rss.xml"> <== no closing </a>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
julianH

Required output

© My Company 2012. All Rights Reserved.   (Feed_Icon)

New HTML with current changes:

<html class="js" dir="ltr" version="XHTML+RDFa 1.0" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/1999/xhtml/vocab">
<body class="html front logged-in two-sidebars page-node toolbar toolbar-drawer admin-menu" style="padding-top: 30px;">
<div id="skip-link">
<div id="overlay-disable-message" class="clearfix">
<div id="toolbar" class="toolbar overlay-displace-top clearfix toolbar-processed">
<div id="header">
<div id="front-page-wrapper">
<div id="page">
<div id="footer" class="c-b">
<div class="footer-inner">
<div id="footer-message">
<div class="footer-inner">
<div id="footer">
© My Company 2012. All Rights Reserved.
<a class="feed-icon" title="Subscribe to www.systrends.com RSS" href="/?q=rss.xml">
</div>
</div>
</div>
</div>
<div id="admin-menu" class="admin-menu-site-systrends7-systrends-com overlay-displace-top admin-menu-processed">
</body>
</html>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does your <a> tag have display: inline; value in css file ?
put the <a class="feed-icon"...> onto the same line as the My Company 2012 and check your styling that you are not styling it to be of type block.   ---  Done

No change

Does your <a> tag have display: inline; value in css file ?    ---

not shure what you're asking but I don't think so. Here is the code.

<div id="footer" class="c-b">
      <div class="footer-inner">
        <?php if ($page['footer']): print render($page['footer']); endif; ?>
        <div class="c-b"></div>
      </div>
      <div id="footer-message">
        <div class="footer-inner">
              <div id="footer"><?php print "&copy Systrends 2012. All Rights Reserved.  " . $footer_message . $footer ?> <?php print $feed_icons; ?></div>
             </div>
      </div> <!-- /footer-message -->
    </div> <!-- /footer -->
The code

<?php print $feed_icons; ?>

Is the second line, right ?
You have to see what's inside $feed_icons variable and add a styling to it in css file with
display: inline;

Can you please put the code with rss back on page, so we can see it online ?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Took many minds to get what needed to be done pounded into my brain.


Thanks again to everyone.