Hello everyone! Needing some help with styling a DOM parse. I have been toying around with the style but continue to end up with whitespace parse errors...
So first of all here is the working code
Sorry about the paste however the code snippet continued to display:
The code snippet in your post is formatted incorrectly. Please use the Code button in the editor toolbar when posting whitespace-sensitive text or curly braces.
Even though I was using the code button.
Currently the list parses in a direct row going down. I want it to display 4-5 elements on a line and then continue to the next row. I figured I would start with downsizing the elements however I am completely new to PHP and not sure how exactly to format CSS into the php element.
I sincerely appreciate all and any help or hints that will lead me on the correct direction.

Recommended Answers

All 5 Replies

<?php
            // Include the library to use it.
            include_once('simple_html_dom.php');

            // Get div from site. ... Need to implement user selected queries.

            $html = file_get_html('http://www.championselect.net/champ/jinx');

            // Put all of the <a> tags into an array named $result
            $result = $html -> find('h2,img[class=CS_Champ_Image],.counterName' )

            // Run through the array using a foreach loop and print each link out using echo
            foreach($result as $element) {
                echo $element."   ";
            }



        ?>
    I tried to add:


        <style type="text/css">
        .size {
        font-size:40%;
        }
        </style>

    And 


         echo "<p class=size">$element."   "</p>;

    With errors...
<?php
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['input']) {
    if (is_int($_POST['input']) { $input = $_POST['input']; }
    }
    ?>
    <form method='post' action=''>
    <input name='input' type='text' id='input' size='10 maxlength='10' />
    <input type='submit'  name='submit' value='submit' />
    </form>

Also when I try to create an HTML form for a user to input a variable that can be passed to the URL it does not seem to work:

$html = file_get_html('http://www.championselect.net/champ/'$input);

However, no luck..

Incorrect sysntax above:
echo "<p class=size">$element." "</p>;
should be:
echo "<p class=\"size\">".$element."</p>";

Try posting one problem at a time with a bit more info on what you are trying to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.