Results 1 to 2 of 2

Thread: Adding a class in a template

  1. #1
    User
    Join Date
    08-04-09.
    Posts
    230

    Default Adding a class in a template

    I am not so handy with php, I am learning, but still I run into little things.

    I have added a read more link in gallery_short:

    Code:
    <p class="leesmeer"><?php echo($this->more)? $this->more: $this->more; ?></p>
    This is the output in html:
    Code:
    <p class="leesmeer">Lees meer...</p>
    I would like to add a class to a href, so i want the output to be:

    Code:
    <p class="leesmeer">Lees meer...</p>
    How can I achieve this? I have tried several thing in the gallery_short template, but without any luck.

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Adding a class in a template

    Quote Originally Posted by lostrisq
    I am not so handy with php, I am learning, but still I run into little things.

    I have added a read more link in gallery_short:

    Code:
    <p class="leesmeer"><?php echo($this->more)? $this->more: $this->more; ?></p>
    this code is "wrong" it always echo this->more, so it should be:

    Code:
    <p class="leesmeer"><?php echo $this->more;  ?></p>
    Quote Originally Posted by lostrisq
    I would like to add a class to a href, so i want the output to be:
    Code:
    <p class="leesmeer">Lees meer...</p>
    How can I achieve this? I have tried several thing in the gallery_short template, but without any luck.
    why do you need to add a class to the anchor?

    you can style it with a

    Code:
    .leesmeer a { ... }
    you can access it through javascript with (using mootools)
    Code:
    $$('.leesmeer a')[0]
    hope this helps in some way
    Consulenza Contao CMS https://www.intco.it

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •