Forum Replies Created

Viewing 15 replies - 31 through 45 (of 88 total)
  • Thread Starter Darek L

    (@darekl)

    Tobias,

    The exported “json file” (original) has something like:

    "data":[["something"]],

    whilst my encoded array was like:

    "data":"[[\"something\"]]"

    There are also codding like \u0142 in both. Any idea how to change it without str_replace("\u0142", "?",$string)?

    Stay tune ?? Now I have mess with the last_id. It is 16 so far ?? Good I saw it on development site ??

    Thanks,
    Darek

    Thread Starter Darek L

    (@darekl)

    Tobias,

    I am not sure what You mean with the “last_id” and where it is used. However this code here is wrong, there should be foreach instead of for ??

    Thanks,
    Darek

    Thread Starter Darek L

    (@darekl)

    Tobias,

    So here it is and working fine with link checker. Tested on development site.

    <?php
    // first find out which of the entries in wp_posts are the correct ones
    $TP_options = json_decode(get_option("tablepress_tables"));
    // get length
    $TP_length = $TP_options->{'last_id'};
    // get IDs
    $TP_IDs = $TP_options->{'table_post'};
    // lets go thru all IDs and create content
    $TP_draftcontent = "";
    for ($i = 1; $i <= $TP_length; $i++)
    {
    	// add table id just for fun ;)
    	$TP_draftcontent .= "\n" . $TP_IDs->{$i} . "\n";
    	// get content for given ID
    	$queried_post = get_post($TP_IDs->{$i});
    	$TP_content = $queried_post->post_content;
    	// well it looks not so good
    	$TP_content = str_replace("kkstarratings","\n",$TP_content);
    	$TP_content = str_replace("div","span",$TP_content);
    	$TP_content = str_replace("[","",$TP_content);
    	$TP_content = str_replace("]","",$TP_content);
    	$TP_content = str_replace('\\"','',$TP_content);
    	$TP_content = str_replace("\\t","",$TP_content);
    	$TP_content = str_replace('"',"",$TP_content);
    	$TP_content = str_replace(",","   ",$TP_content);
    	$TP_content = str_replace("\\/","/",$TP_content);
    	// now little better
    	$TP_content = apply_filters('the_content', $TP_content);
    	// add it and go to next
    	$TP_draftcontent .= $TP_content;
    }
    // lets print it for check
    print($TP_draftcontent);
    // so lets update the draft now with new content
    $post_settings = array('ID' => get_the_ID(), 'post_content' => $TP_draftcontent);
    wp_update_post($post_settings);
    ?>

    I know it would be better if there would be button for it ?? maybe someday ??

    Thanks,
    Darek

    Thread Starter Darek L

    (@darekl)

    So the manual copy and paste into draft will be done automatically by PHP code assigned to draft page and activated during reload of that draft page ?? smart isn’t it? ??

    Thread Starter Darek L

    (@darekl)

    Tobias, Of course the content should be written into db as draft page. Now the PHP code above only print on screen and link checker don’t see it yet. So when I reload the draft page it will refresh the draft db content ?? This is how it should be ??

    Thread Starter Darek L

    (@darekl)

    Tobias,

    You are right about HTML table tags, it is not problem for link checker but I don’t need them.

    when are you running that code?

    When I manually copy exported TablePress HTML file and past it into draft page, the link checker is able to see it and works fine.

    Now I want to generate it in the same page position (after header but before footer – means content of the draft page) but via PHP code automatically – not sure if this will be working – I hope so.

    And here is the version with json_decode():

    <?php
    // first find out which of the entries in wp_posts are the correct ones
    $TP_options = json_decode(get_option("tablepress_tables"));
    // get length
    $TP_length = $TP_options->{'last_id'};
    // get IDs
    $TP_IDs = $TP_options->{'table_post'};
    // now lets get content for each ID
    for ($i = 1; $i <= $TP_length; $i++)
    {
    	print("<b>".$TP_IDs->{$i}."</b>");
    	print("<br/>");
    	$queried_post = get_post($TP_IDs->{$i});
    	$TP_content = $queried_post->post_content;
    	// well it looks not so good
    	$TP_content = str_replace("kkstarratings","<br/>",$TP_content);
    	$TP_content = str_replace("div","span",$TP_content);
    	$TP_content = str_replace("[","",$TP_content);
    	$TP_content = str_replace("]","",$TP_content);
    	$TP_content = str_replace('\\"','',$TP_content);
    	$TP_content = str_replace("\\t","",$TP_content);
    	$TP_content = str_replace('"',"",$TP_content);
    	$TP_content = str_replace(",","?????",$TP_content);
    	$TP_content = str_replace("\\/","/",$TP_content);
    	// now little better
    	$TP_content = apply_filters('the_content', $TP_content);
    	// so lets show it
    	print($TP_content);
    }
    ?>

    Regards,
    Darek

    Thread Starter Darek L

    (@darekl)

    Tobias,

    This:

    $table_id = '123';
    $table = TablePress::$table_model->load( $table_id )

    gave me this:

    Fatal error: Access to undeclared static property: TablePress::$table_model

    and this:

    echo tablepress_get_table( array( 'id' => '123' ) );

    just print the table like shortcode does but link checker is not able to see links inside such table.

    I’m not exactly sure what you are trying to do

    So I have to create page (draft) with links without jquery and without HTML table tags and automatically not by copy TablePress HTML export files info draft page manually each time I change single link.

    Thanks,
    Darek

    Thread Starter Darek L

    (@darekl)

    Tobias, This is correct that first I have to check in table wp_options the correct IDs and then print content for each ID?

    I saw that in wp_posts are more entries (rows) than actual tables.

    Thread Starter Darek L

    (@darekl)

    I’m not sure why you are seeing empty CSS files there

    Tobias, In the past I had custom CSS in admin panel in TablePress settings. But now I make custom TablePress CSS section in style.css file. So maybe this is why they now are empty.

    Large tables with several thousand rows are more an issue on the “Edit” screen, as most browsers have problems with that many text fields then.

    Now I have 80 rows in one table ?? I hope the limit is not so close ??

    Thanks,
    Darek

    Thread Starter Darek L

    (@darekl)

    Using custom DB tables (like wp_TPress_tables and similar) is not an option though. This would just clutter the database, and the existing data structures in WordPress

    Tobias, the wordpress structure is not good thought out. In my opinion it is big mess, the plugins are mixed with posts and instalation specific options.

    Regarding TablePress I saw also tablepress-custom.css and tablepress-custom.min.css files in a wp-content folder. They are empty and don’t know if they can be removed or not?

    Also I saw that all table content is stored in one cell. What about limits in this case? What about large tables? I don’t know e.g. about 1000 or more rows?

    Thanks,
    Darek

    Thread Starter Darek L

    (@darekl)

    Tobias,

    As the tables are stored in the database (content in wp_posts, meta data in wp_postmeta, and post ID to table ID relationships as well as plugin options in wp_options), backing that up will also back up tables.

    I checked the database via phpmyadmin and I saw there is also something related to the TablePress in wp_usermeta. Also I saw there are some old entries in wp_posts.

    The automatic backup of TablePress would be more possible if the db structure would be like e.g.:

    wp_TPress_tables   <- for TablePress tables only
    wp_TPress_options  <- for TablePress options only

    In this case it would be easy to set up tool for automatic backup only such tables (one or both). Now is more problematic because in table wp_postmeta are also settings for other plugins. Moreover the wp_options is strictly related to the wordpress installation and shouldn’t be just imported to the new database (even if there is only other db name).

    Regards,
    Darek

    Thread Starter Darek L

    (@darekl)

    Janis,

    Thanks for the quick response. I know that TablePress is not supported right now but it will be in the future? There are any plans for that?

    Regards,
    Darek

    Thread Starter Darek L

    (@darekl)

    Note that another method for backing up TablePress tables would be to create a full backup of the mySQL database.

    Tobias, Yes, I was thinking about it too but it would make the plugin totally custom. All database structure changes would impact it.

    However, the actual JSON table data will be part of the exported XML.

    So there is small light in the tunnel ??

    It’s just not yet possible to re-import them with the WordPress importer. I’m however working on that for the future.

    If so this will make the tools for automatic backup working fine and also will solve my problem and maybe some other people ( I know you don’t believe that such people can exist ?? ).

    Thanks and can’t wait for the fix,
    Darek

    Thread Starter Darek L

    (@darekl)

    The JSON format that TablePress uses now is much better

    Tobias, JSON is great format for data but in case of wordpress it is rather future format or not supported. Currently tools for automatic backup are not able to see other backup files except wordpress exported XML file – very sad but true. So the backup of TablePress cannot be automated right now ;(

    Thread Starter Darek L

    (@darekl)

    Tobias, The content of tables (links) is more important to me than options of TablePress. The TablePress options not change so often, and can be remembered much easier than links ??

Viewing 15 replies - 31 through 45 (of 88 total)