Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Style for PHP echo Links

    Hello,

    I have created a php echo within a divider to show links to extra pages within a table, it should look like '1 2 3 >' but all I can see is the text for the current page I am on and NOT the other page links and the arrows. Here is the code:

    Code:
    <div id="page-links" style="color:#000;"><?php echo $objtrucks->Links; ?></div>
    As you can see the style for the div link is working only to display the current page number (which isn't actually a link) but not on the links themselves. I need a way to assign the php echo to a class itself so I can set the links... for example

    Code:
    .phpecholink:active{
    color:black;
    text-decoration:none;
    }
    .phpecholink:visited{
    color:blue;
    text-decoration:none;
    }
    .phpecholink:hover{
    color:black;
    text-decoration:underline;
    }
    I don't know how to assign the class or ID though... I have already tried it on the divider and the code doesn't work. Thanks

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,920
    Thanks
    15
    Thanked 228 Times in 228 Posts
    It's only doing what you tell it to do. If you want it to display more links you will have to loop over the entire array. This should be in the php section in any case.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #3
    Regular Coder
    Join Date
    Mar 2013
    Posts
    262
    Thanks
    4
    Thanked 67 Times in 67 Posts
    I'm not sure if I'm entirely following the question. Couldn't you just do something like this?

    Code:
    #page-links a:active {
        /* code */
    }
    #page-links a:visited {
        /* code */
    }
    #page-links a:hover {
        /* code */
    }
    My signature :)

  • #4
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    It's only doing what you tell it to do. If you want it to display more links you will have to loop over the entire array. This should be in the php section in any case.
    The PHP is correctly displaying the links it's just that they are white (except the current page which isn't actually a link) but when I highlight them with my mouse I can see them. I'm just looking for a way to stylize them. Thanks

  • #5
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,102
    Thanks
    23
    Thanked 594 Times in 593 Posts
    @Rcoleman25, Your styling a class (.phpecholink) you don't have. I think ttkim is right.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #6
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,920
    Thanks
    15
    Thanked 228 Times in 228 Posts
    You're confusing matters by showing the php. The php has nothing to do with the style, the style is only applied to the rendered HTML.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #7
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    @Rcoleman25, Your styling a class (.phpecholink) you don't have. I think ttkim is right.
    The code ttkim used still doesn't work... the thing is I show the underline on 'Hover' and when I do that I can see the underline but the links still aren't readable although I can click on them. I have no idea why the text-decoration property is working but the color property is not. Any thoughts?

  • #8
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,920
    Thanks
    15
    Thanked 228 Times in 228 Posts
    Quote Originally Posted by Rcoleman25 View Post
    The code ttkim used still doesn't work... the thing is I show the underline on 'Hover' and when I do that I can see the underline but the links still aren't readable although I can click on them. I have no idea why the text-decoration property is working but the color property is not. Any thoughts?
    You still haven't shown us the HTML that the style applies to. That's what we need to see. You're wasting everyone's time by not showing it.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #9
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    You still haven't shown us the HTML that the style applies to. That's what we need to see. You're wasting everyone's time by not showing it.
    This is the HTML code... I have a divider with a table in it to display search results and I have it set to display the pages if there are more than 50 search results...

    Code:
    <div style="height:216px;width:690px;overflow:auto;border:1px solid rgb(100,100,120);margin-left:341px;">
            <table style="font-size:14px;border-collapse:collapse;width:99%">
            <?php if($objtrucks->Trucks) { ?>
                <?php foreach($objtrucks->Trucks as $objtruck) { ?>
                    <tr>
                        <td style="width:4%;"><input type="checkbox" name="truck_id[]" id="truck_id" value="<?php echo $objtruck->id; ?>"></td>
                        <td style="width:13%;"><a style="color:#00F !important;" class="loginlink2" href="<?php echo Request::$BASE_PATH; ?>detailtrucks/<?php echo $objtruck->id; ?>"><?php echo date('m/d', strtotime($objtruck->start_date)); ?>-<?php echo date('m/d', strtotime($objtruck->end_date)); ?></a></td>
                        <td style="width:24%;"><?php echo $objtruck->origin_city; ?><span style="margin-left:3px;">&nbsp;&nbsp;&nbsp;<?php echo $objtruck->origin_state; ?></td>
                        <td style="width:33%;"><?php echo ($objtruck->destination_state != '')?$objtruck->destination_city.'&nbsp;&nbsp;&nbsp;'.$objtruck->destination_state:'USA'; ?></td>
                        <td style="width:11%;"><?php echo $objtruck->vehicle_type; ?></td>
                        <td style="width:9%;"><?php echo $objtruck->truck_size; ?></td>
                        <td style="width:6%;"><?php echo $objtruck->truck_count; ?></td>
                    </tr>
               <?php } ?>
                <?php if($objtrucks->totalPages > 1){ ?>
                    <tr style="height:50px;">
                        <td colspan="11" style="text-align:center;"><div id="page-links"><?php echo $objtrucks->Links; ?></div></td>
                    </tr>
                <?php } ?>
            <?php } ?>
            </table></div>
    Here is the CSS code which is in a separate stylesheet linked to the above HTML page in the header.

    Code:
    #page-links:active {
    color:black;
    text-decoration:none;
    }
    #page-links:visited {
    color:black;
    text-decoration:none;
    }
    #page-links:hover {
    color:black;
    text-decoration:underline;
    }
    The '<?php echo $objtrucks->Links; ?>' IS essentially the part of the page that displays the links... I don't know what else to show you...

  • #10
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts
    I have attached some screenshots of the issues.

    Image 1: What the links look like normally

    Image 2: Links with mouse hover

    Image 3: Selecting the text with my cursor (no hover)
    Attached Thumbnails Attached Thumbnails Style for PHP echo Links-1.jpg   Style for PHP echo Links-2.jpg   Style for PHP echo Links-3.jpg  

  • #11
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,920
    Thanks
    15
    Thanked 228 Times in 228 Posts
    You do not understand. You are still showing us the php code. The browser NEVER sees the php part of the code. It only sees the delivered HTML. To get that you have to open the page with your browser and choose the option 'view source'. Then you select all of that, then copy and paste it into a message or text file. Nowhere in it will you see <?php . That is what the style applies to.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #12
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    You do not understand. You are still showing us the php code. The browser NEVER sees the php part of the code. It only sees the delivered HTML. To get that you have to open the page with your browser and choose the option 'view source'. Then you select all of that, then copy and paste it into a message or text file. Nowhere in it will you see <?php . That is what the style applies to.
    Oh ok... I understand... here ya go...

    Code:
    <td colspan="11"><div id="page-links"><span style="font-size:14px;"><u>1</u></span>&nbsp;<a href="#" onclick="return refreshPage('2');">2</a>&nbsp;<a href="#" onclick="return refreshPage('3');">3</a>&nbsp;<a href="#" onclick="return refreshPage('4');">4</a>&nbsp;<a href="#" onclick="return refreshPage('5');">5</a>&nbsp;<a href="#" onclick="return refreshPage('6');">6</a>&nbsp;<a href="#" onclick="return refreshPage('7');">7</a>&nbsp;<a href="#" onclick="return refreshPage('8');">8</a>&nbsp;<a href="#" onclick="return refreshPage('9');">9</a>&nbsp;<a href="#" onclick="return refreshPage('10');">10</a>&nbsp;<a href="#" onclick="return refreshPage('11');">11</a>&nbsp;...&nbsp;<a href="#" onclick="return refreshPage('2');">></a>&nbsp;<a href="#" onclick="return refreshPage('234');">>></a></div></td>
            </tr>
    I see what the problem is... I created the style for the DIVIDER but I still need to create a class for the individual page links and stylize that. How exactly do I create and ID or class for those 'a' links since I can't even see them in the regular HTML?

  • #13
    Regular Coder
    Join Date
    Mar 2013
    Posts
    262
    Thanks
    4
    Thanked 67 Times in 67 Posts
    Well, if that CSS code sample you posted is what you used, that's not what I suggested.

    Your CSS is styling the "#page-links" itself. I said to style "#page-links a".

    If that still doesn't work, then we would need one of these things:

    1. A link to the site
    2. All your stylesheets and in the correct order
    3. Or, you would have to show us what "$objtrucks->Links;" is doing so we can add classes like you wanted.
    My signature :)

  • #14
    New Coder
    Join Date
    Jun 2012
    Posts
    40
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ttkim View Post
    Well, if that CSS code sample you posted is what you used, that's not what I suggested.

    Your CSS is styling the "#page-links" itself. I said to style "#page-links a".

    If that still doesn't work, then we would need one of these things:

    1. A link to the site
    2. All your stylesheets and in the correct order
    3. Or, you would have to show us what "$objtrucks->Links;" is doing so we can add classes like you wanted.

    I tried the "#page-links a" and that didn't work either. The "objtrucks->Links;" is creating all of the "<a href="#" onclick="return refreshPage('2');">2</a>" for the individual pages and "> >>". I would like if I could attach a class to all of the 'a' codes for the "objtrucks->Links;" and then set a style for the class to display the links properly.

  • #15
    Regular Coder
    Join Date
    Mar 2013
    Posts
    262
    Thanks
    4
    Thanked 67 Times in 67 Posts
    Yes, we know what objtrucks->Links does, but we need to see the actual code if you want us to help you attach a class to it.

    If not, you have to show your stylesheet (and I mean all of it) or a link to your page. Most likely, you are missing something from your stylesheets because what I suggested should work. Something is overriding it.
    My signature :)


  •  

    Posting Permissions

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