0
Welcome Guest! Login
0 items Join Now

ROCKETTHEME IS CLOSING ON JUNE 30, 2025. As a thank-you to our community, enjoy 50% off all themes with the promo code THANKYOU before we shut down. Read our Farewell Blog Post for more details.

how to insert css code into php?

    • Kraven's Avatar
    • Kraven
    • Sr. Rocketeer
    • Posts: 190
    • Thanks: 0

    how to insert css code into php?

    Posted 16 years 2 months ago
    • Hi, Im trying to inser css into deafault.php (latest news module).

      I want to make a table with border and background.. but I got a lot of errors from validation doing that if I try to make trough css the validator sayts that I have to put this inside <head><link href="myCSSfile.css" rel="stylesheet" type="text/css" /> </head> but if I do that got errors too.

      I want to put the results appearing inside that table.
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#E0E0E0" width="100%" bgcolor="#F6F6F6">
      <?php // no direct access
      defined('_JEXEC') or die('Restricted access'); ?>
      <ul class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
      <?php foreach ($list as $item) :  ?>
           <li class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
                <a href="<?php echo $item->link; ?>" class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
                     <?php echo $item->text; ?></a>
           </li>
      <?php endforeach; ?>
      </ul>

      what is the best way to put the results inside the table?

      Thank you
    • Ragdata's Avatar
    • Ragdata
    • Elite Rocketeer
    • Posts: 614
    • Thanks: 0
    • Software Engineer

    Re: how to insert css code into php?

    Posted 16 years 2 months ago
    • I would imagine the best way to do it would be to insert your custom CSS declarations into a CSS file that is already being loaded by your site (template). Try putting them into your css/template_css.css file.
    • Ragdata's Rubber Duck
      www.ragdata.net/
    • Kraven's Avatar
    • Kraven
    • Sr. Rocketeer
    • Posts: 190
    • Thanks: 0

    Re: how to insert css code into php?

    Posted 16 years 2 months ago
    • Ragdata wrote:
      I would imagine the best way to do it would be to insert your custom CSS declarations into a CSS file that is already being loaded by your site (template). Try putting them into your css/template_css.css file.

      I tried that but I still get errors ffrom validation when the php calls the css <link href="myCSSfile.css" rel="stylesheet" type="text/css" />

      I want to know how can I call a css function inside the php code.
    • Ragdata's Avatar
    • Ragdata
    • Elite Rocketeer
    • Posts: 614
    • Thanks: 0
    • Software Engineer

    Re: how to insert css code into php?

    Posted 16 years 2 months ago
    • The validation is the reason that I suggested including the CSS in a file that is already being called by your template. I think (from what I can see) that you're confused about the module's place in the order of execution - a module can't have a <head> tag, which would cause huge validation errors. If you had, indeed, tried including the CSS in a file that is already being called by your template, then you wouldn't be getting validation errors.

      To make it easy though, you can include your custom CSS in a <style></style> tag inline with your PHP in the module. While this works, it is not technically valid and would result in yet another validation error - but it WOULD work.
    • Ragdata's Rubber Duck
      www.ragdata.net/
    • Kraven's Avatar
    • Kraven
    • Sr. Rocketeer
    • Posts: 190
    • Thanks: 0

    Re: how to insert css code into php?

    Posted 16 years 2 months ago
    • ok, so I just put what I want on the template css, example

      table.c6 {...................}

      and on the php I put class="c6" ?

      thanks
    • Ragdata's Avatar
    • Ragdata
    • Elite Rocketeer
    • Posts: 614
    • Thanks: 0
    • Software Engineer

    Re: how to insert css code into php?

    Posted 16 years 2 months ago
    • Kraven's Avatar
    • Kraven
    • Sr. Rocketeer
    • Posts: 190
    • Thanks: 0

    Re: how to insert css code into php?

    Posted 16 years 2 months ago
    • Thanks man that worked!! and you solved most of my problems of validation :cheesy:
  • Re: how to insert css code into php?

    Posted 16 years 2 months ago

Time to create page: 0.059 seconds