Jump to content

Styling PHP code output help ????


mcpainter02

Recommended Posts

Hello, I need some simple help styling the output of some simple php code, I have attached a view of what the output is of right now and of what I need it to look like in the end, I have tried several times myself with faulty results. The number 3 in the first screenshot attachment is what I am looking for on the article count code, it has a div style of

<div class="cart-count">

the number 5 is the output of the code and that is what I need changed to the cart count class. I need the article count to be centered and to the left of the text output code, example of what I am looking for is in screenshot2 attachment. Can someone please help???

 

<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<div class="articles_count<?php echo $params->get('moduleclass_sfx'); ?>">

<!--- I need this article count to have a different output style then the next php code below, I also need to have it float center and to the left--->
<?php foreach($lists->artcount as $key => $value): ?>
                          <!--- End --->

<!--- I need this to float center and right to the above article count code --->
<?php echo trim($params->get('beforeText')); ?> <?php echo $value; ?>
                                         <!--- End --->

<?php if ($lists->type == 'section'){ echo trim($params->get('afterTextSection')); } else {echo trim($params->get('afterTextCategory')); } ?> <?php echo $lists->names[$key]; ?>
<?php endforeach; ?>

 

[attachment deleted by admin]

Link to comment
Share on other sites

Does that mean I cant get some simple help here at this PHP help forum? I am not looking to pay someone to do freelance work, This is a simple 2 min fix. I just can't figure it out myself. Sorry if I posted to the wrong forum, was just looking for a little help is all.

Link to comment
Share on other sites

Does that mean I cant get some simple help here at this PHP help forum? I am not looking to pay someone to do freelance work, This is a simple 2 min fix. I just can't figure it out myself. Sorry if I posted to the wrong forum, was just looking for a little help is all.

 

time is irrelevant. If you want others for you to code, and your not showing your efforts in the form of for instance code. this is not the right forum, but the freelance one is. IF on the other hand your showing that effort, (maybe you were close, but just missed a simple thing, or more complex), anything but the freelance forum is the right place. So if you've tried something show it.  happy to help, certainly as far as css

Link to comment
Share on other sites

Sorry, from what I have just learned by doing a little more research is that I need to know how to ad a font size echo within this piece of code, I was asking the wrong question. Please forgive me, I am a newbie!!

 

I would like to ad a font size echo to this code, Can someone please help???

<?php foreach($lists->artcount as $key => $value): ?>

Link to comment
Share on other sites

the problem with that little snippet is, is that we have no idea what the value is of the variable. besides that it's way better to separate style from code. so what i would do instead of directly outputing it like doing this

<?php foreach($lists->artcount as $key => $value){
echo'<p style="font-size:1.2em;>'.$value.'</p>"'; // this is called inline style in css 
}
?>

 

instead I would put this function inside a container to set it's value from outside by using a stylesheet.

 

<div id="counter">
  .....
<?php 
    foreach($lists->artcount as $key => $value){
    echo $value;
    }
?>

  .....
</div>

and than in a stylesheet you just say

 

#counter{
  font-size:1.2em;

}

or you give it a class

 

<?php foreach($lists->artcount as $key => $value){
echo'<p class="counter">'.$value.'</p>"'; // assigning a class to target it from a stylesheet 
}
?>

 

But again, defining the looks of something is based on the output, so what you could better do and present us is just right click view source copy paste and post the portion you know that is the right one. maybe it allready has an ide or class or anything so it can be targeted from a stylesheet. But as you might have guessed the stuff(html) coming from that php script we can't know

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.