Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Posts posted by Jessica

  1. Pretty sure you don't actually understand what a framework is.

     

     

     

    Also: some people actually like to learn new things. SOME people excel when given new things to learn. Some people thrive on learning. What is the point of just learning a few functions then writing the same shitty code over and over?

     

    In the past 4 months I've started using various new-to-me "things": Symfony, Behat, (obviously composer), YML, Silex, Vagrant, and Doctrine. Also had to investigate Kohana a little as we're moving off it.

     

    I've never been happier at work. I actually got to spend my work time writing a Formatter for Behat which we're going to release. My first ever open source contribution. If I just stuck with "old fashioned" php I'd be miserably making the same stupid "contact us" forms and calendar apps I was doing 5 years ago, and making a third of what I make now (in terms of money and actual software too)

  2. Google "CRUD" and PHP/MySQL.

     

    What you're describing is super basic. I have a tutorial on my blog, see my signature.

     

    If you need more specific help, post your code and describe your problem.

  3. Sure you can. How do you expect to use a table that has data just smushed together? As you are discovering, it sort of eliminates all the benefits of a relational database

  4. I like the fact that Twig has the shortcuts "Twig has shortcuts for common patterns, like having a default text displayed when you iterate over an empty array:"

    {% for user in users %}
        * {{ user.name }}
    {% else %}
        No user have been found.
    {% endfor %}
    How can you use this if you're generating a table?

    For example, I have this:

    <table class="table table-bordered table-striped table-hover">
                <tr>
                    <th>Name</th>
                    <th>Description</th>
                    <th>Actions</th>
                </tr>
    
                {% for service in services_table %}
                <tr>
                    <td>{{ service.name }}</td>
                    <td>{{ service.description }}</td>
                       <td>
                            <a class="btn btn-mini btn-primary btn-block" href="{{ path('admin_edit_service', {'id':service.id}) }}"><i class="icon-pencil icon-white" title="Edit"></i> Edit</a>
    
                            <a class="btn btn-mini btn-danger btn-block" href="{{ path('admin_delete_service', {'id':service.id}) }}"><i class="icon-trash icon-white" title="Delete"></i> Delete</a>
                        </td>
                    </tr>
    {% endfor %}
                </table>
    
    If I wanted to use the shortcut {% else %} block to display a message, I'd have already started the table header. So what I've been doing instead is wrapping the above code in an
    {% if services_table|length %} ... {% else %}
    which is less elegant.

     

    How do you handle this? Display the table including headers if there are rows, otherwise display an else message?

  5. Viewing page: 1 of 10

    [ *1* 2 3 4 5 ]

     

    Viewing page: 2 of 10

    [ *2* 3 4 5 6 ]

     

    Viewing page: 3 of 10

    [ *3* 4 5 6 7 ]

     

    Viewing page: 4 of 10

    [ *4* 5 6 7 8 ]

     

    Viewing page: 5 of 10

    [ *5* 6 7 8 9 ]

     

    Viewing page: 6 of 10

    [ *6* 7 8 9 10 ]

     

    Viewing page: 7 of 10

    [ 6 *7* 8 9 10 ]

     

    Viewing page: 8 of 10

    [ 6 7 *8* 9 10 ]

     

    Viewing page: 9 of 10

    [ 6 7 8 *9* 10 ]

     

    Viewing page: 10 of 10

    [ 6 7 8 9 *10* ]

    <?php
    
    $display_pages = 5;
    $total_pages = 10;
    
    
    for($i=1; $i<=10; $i++){
    	$current_page = $i;
    	echo "Viewing page: {$current_page} of {$total_pages}\n";
    	
    	echo '[';
    	$start = $current_page;
    	if($total_pages-$start < $display_pages){
    		$start = ($total_pages-$display_pages)+1;
    	}
    	for($k=$start; $k<($start+$display_pages); $k++){
    		if($k==$current_page){
    			echo " *{$k}* ";
    		}else{
    			echo " {$k} ";
    		}
    	}
    	echo ']';
    	echo "\n\n";
    }
    
×
×
  • 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.