Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    I’m not really sure what you mean with “client’s edit page”. Do you mean the “Edit” page of a post or page, with the text editor?
    On that page, you can use the “Table” button in the editor toolbar, to get such a list and then insert the Shortcode.

    If that is not what you want, can you maybe describe it again? Maybe with a screenshot of the location that you are refering to?

    Thanks,
    Tobias

    Hi Tobias,

    I wonder if you can help me…

    I am using table reloaded, and have a simple table with 1 row and 2 cells. The first cell I have a promotionslider and the other I have embedded you tube video and tey both work correctly.

    The issue is that they do not seem to line up, which seems very strange. Below is the link to a teat page…

    http://croftweb.co.uk/chaser/?page_id=1411

    Please help, its driving me mad!!

    Thanks
    Liam

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Liam,

    I will answer your question at http://wordpress.org/support/topic/plugin-wp-table-reloaded-column-css-style as it fits better there and so that this post does not get cluttered.

    Regards,
    Tobias

    Ok Tobias, Cheers.

    Thread Starter consumedesign

    (@consumedesign)

    Sorry Tobias, in my head I was making a lot of sense ha… check out the image:
    http://consumedesign.com/extras/tables-reloaded.png

    I added a sidebar item for my client which has some Options only for their site… it’s called Custom Options. What I’m interested in doing is pulling all the table’s names and IDs to create a dropdown under ATTACH TABLE. I’ve tried some of the “wp_table_reloaded_” functions but it always says function not found. I was going to start looking though your scripts and see if I can come up with the right way of creating it but thought maybe someone could save me some time, ha…

    thanks!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, ok. Thanks for the clarification.
    Unfortunately, I don’t have a solution to this and I don’t really see how a solution could look like πŸ™

    Maybe the file view-ajax_list.php in the views folder will be helpful. That is basically the code that generates the list of tables that you get by clicking that “Table” button in the editor toolbar.

    Regards,
    Tobias

    Thread Starter consumedesign

    (@consumedesign)

    Thanks. I’ll check it out. If all else fails I’ll have them input the table ID and do it that way. I was just hoping for a cleaner and easier solution since this client isn’t very computer/web literate ha…

    BTW, great plug in, gets better with each version too.

    Thread Starter consumedesign

    (@consumedesign)

    hey Tobias… if you don’t mind sharing, how do you get the info from the DB to the page? I see “count( $this->tables )” but not clear on where that is originally stored.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    tables is a class member variable of the $WP_Table_Reloaded_Admin class variable. The relevant code is in the controller-base.php I believe.
    It might already be enough to replace $this with $WP_Table_Reloaded_Admin and to add a global $WP_Table_Reloaded_Admin; at the beginning of the function where you use this, to make the global variable available.

    Regards,
    Tobias

    Thread Starter consumedesign

    (@consumedesign)

    Yup, was working on doing just that and figured it out, sort of… need to apply it to my hook still:

    include_once( WP_TABLE_RELOADED_ABSPATH . 'controllers/controller-admin.php' );
    $WP_Table_Reloaded_Admin = new WP_Table_Reloaded_Controller_Admin();
    if ( 0 < count( $WP_Table_Reloaded_Admin->tables ) ) {
    	foreach ( $WP_Table_Reloaded_Admin->tables as $id => $tableoptionname ) {
    		$table = $WP_Table_Reloaded_Admin->load_table( $id );
    		$name = $WP_Table_Reloaded_Admin->helper->safe_output( $table['name'] );
    		unset( $table );
    		echo "<P>NAME: {$name} ID:{$id}";
    	}
    } else {
    }
    Thread Starter consumedesign

    (@consumedesign)

    Final code:

    global $WP_Table_Reloaded_Admin;
    	$meta_value = get_post_meta($post_ID, 'table_ID', true);
    	echo '<P><strong>ATTACH TABLE:</strong><p><select name="table_ID" style="width:100%">';
    	echo '<option value="">NONE</option>';
    	foreach ( $WP_Table_Reloaded_Admin->tables as $id => $tableoptionname ):
    		$table = $WP_Table_Reloaded_Admin->load_table( $id );
    		$name = $WP_Table_Reloaded_Admin->helper->safe_output( $table['name'] );
    		unset( $table );
    		if($meta_value == $id): $selected = ' selected'; else: $selected = NULL; endif;
    		echo '<option value="'.$id.'"'.$selected.'>'.$name.'</option>';
    	endforeach;
    	echo '</select></p>';

    Screen shot:
    http://consumedesign.com/extras/tables-reloaded-done.png

    Thread Starter consumedesign

    (@consumedesign)

    Front end:

    <? if($table_ID = get_post_meta($option->ID, 'table_ID', true)): ?><P><? echo apply_filters('the_content', '[table id='.$table_ID.' /]'); ?></p><? endif ?>

    Works great, thanks Tobias your support is amazing. When I get a few bucks in my paypal account expect a donation!

    Screen (needs styled still):
    http://consumedesign.com/extras/tables-reloaded-front.png

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    very nice solution indeed!
    Just two minor fixes/ideas:
    – Instead of $selected = NULL, you should go with $selected = ''. While it might not cause problems, I feel that it is kind of ugly to (in the next line) echo a NULL.
    – Instead of

    echo apply_filters('the_content', '[table id='.$table_ID.' /]');

    I suggest to either use

    echo do_shortcode( '[table id='.$table_ID.' /]' );

    or the WP-Table Reloaded template tag function (see the docs). That should be a little bit more robust and reduces overhead as not all filters need to be run on the Shortcode.
    Also, I suggest to not wrap the table in <P></P> HTML tags, as that could be invalid HTML.

    And thanks for wanting to donate, I really appreciate it!

    Best wishes,
    Tobias

    Thread Starter consumedesign

    (@consumedesign)

    Cool, thanks… I don’t consider myself a programmer so things are a little sloppy from time to time ha…

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[wp-table-reloaded] getting titles of tables’ is closed to new replies.