webmotivated
Forum Replies Created
-
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] Find Row Numberok Thx Tobias.
ok Thx Tobias.
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] cell shortcode generated by phpTobias
Thank you for your help. The last one worked.Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] cell shortcode generated by phpTobias
Struggling here as you can see. Your instructions not clear, sorry.
When you say “try adding
global $txt;in your code”, did you mean adding it in the TablePress cell like so:<?php global $txt; echo $GLOBALS['txt']; ?>? Please clarify.If not, presume you meant adding
global $txt;to my custom-page.php template used by the page + while keeping<?php echo $GLOBALS['txt']; ?>in the TablePress cell? Yes?If yes, then already tried
<?php echo $GLOBALS['txt']; ?>in TablePress + below code in the custom-page.php without luck:
option 1 [Error message: Notice: Undefined index: txt…]global $txt; $txt = 1; echo $txt;option 2 [Error message: Notice: Undefined index: txt…]
$txt = 1; //Global stuff function global_stuff() { global $txt; return $txt; } echo $txt;Code in all these options outputs 1 onto the page successfully, however
<?php echo $GLOBALS['txt']; ?>fails @ TablePress.I guess what would help me since I’m so lost now, is some quick example which works on your side and so should work on my side. In case it wouldn’t work on my side, but i knew it should work (because you told me so), then I would keep pushing my WP environment until it works. Looks like I need to sort out the basics before I start handling shortcodes with PHP into TablePress. Otherwise I’m now in situation where I haven’t seen even the tinny example of success of using php in the TablePress cell. By example I mean: 1) what should I put in my custom-page.php so to create a global $txt 2)what should I put in the tablepress cell –> kind of clear now that it should be
<?php echo $GLOBALS['txt']; ?>. So then I’d appreciate if you could send me quick example of 1) which should definitely work with 2). Possible?- This reply was modified 6 years, 4 months ago by webmotivated.
- This reply was modified 6 years, 4 months ago by webmotivated.
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] cell shortcode generated by phpTobias
Noticed
?is missing at the end in your last post, so should be
<?php echo $GLOBALS['txt'] ;?>, yes?.It still does not work; error once
<?php echo $GLOBALS['txt'] ;?>is pasted into a TablePress cell:
Notice: Undefined index: txt in /var/www/wp-content/plugins/tablepress-php-in-tables/tablepress-php-in-tables.php(26) : eval()’d code on line 1—
$txtis defined as follows in the custom-page.php template:$TablePress_Table_ID = 1; $txt = do_shortcode( '[table-cell id=1 cell=D2/]' ); // Tobias's example add_shortcode( 'my-var', 'webmotivated_handle_my_var_shortcode' ); function webmotivated_handle_my_var_shortcode() { global $txt; return $txt; }- This reply was modified 6 years, 4 months ago by webmotivated.
- This reply was modified 6 years, 4 months ago by webmotivated.
- This reply was modified 6 years, 4 months ago by webmotivated.
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] cell shortcode generated by phpTobias, ok i see
RE: PHP IN CELLS. I’ve activated the extension https://tablepress.org/extensions/php-in-tables/. So given
echo $txtfires what I need into the page OK, how can i now make use of$txtvariable in the TablePress cell so that it works?? In other words, in what syntax shall i put it? Asking because<?php echo $txt;>inside TablePress Cell doesn’t work. Details below.<?php echo $txt;>causes: Parse error: syntax error, unexpected ‘>’, expecting end of file in /var/www/wp-content/plugins/tablepress-php-in-tables/tablepress-php-in-tables.php(26) : eval()’d code on line 1<?php echo $txt;causes: Notice: Undefined variable: txt in /var/www/wp-content/plugins/tablepress-php-in-tables/tablepress-php-in-tables.php(26) : eval()’d code on line 1RE: LOAD ORDER. OK will do some google into this. Can you just confirm load order might affect both
[my-var]way and<?php echo $txt>way of doing things or just one of these ways?Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] cell shortcode generated by phpTobias, Thanks for your builds.
Yes exactly. The reason why I’m doing this is because “the Shortcode (the parameters) are dynamically created/changing”.
–
echo $txt;in below code drops “Ruby” onto my web page which uses custom-page.php as template (by this I mean on a page, yet I need it in my tablepress table as well). You’ll see in below code I’m using non-dynamic shortcode, this is temporary while I’m solving this.
-[my-var] (entered either into a TablePress cell like shown below or just into plain WP shortcode) still displays as [my-var] and that’s my main problem (expecting “Ruby”, because expected result of [table-cell id=1 cell=D2/] = “Ruby”).
-And so where I’m struggling is pushing “Ruby” into the tablepress cell using the shortcode [my-var].This php code is in custom-page.php template (…so NOT in the TablePress cell).
<...> $TablePress_Table_ID = 1; //$txt = sprintf("[table-cell id=%u cell=D%u/]",$TablePress_Table_ID, $sat_day); // generates dynamic shortcode, temporarily off. $txt = do_shortcode( '[table-cell id=1 cell=D2/]' ); // Tobias's example add_shortcode( 'my-var', 'webmotivated_handle_my_var_shortcode' ); function webmotivated_handle_my_var_shortcode() { global $txt; return $txt; } echo $txt;This php code is inside the cell @ TablePress
[my-var]Bit lost here…
-how do I code the custom-page.php template so that I can then enter[my-var]into the desired tablepress cell and see “Ruby” (cell D2 in table 1 = Ruby and so [table-cell id=1 cell=D2/]=”Ruby”)?
-alternatively, in what syntax do I need to reference $txt inside desired tablepress cell so that I can see “Ruby” as a result. (asking becauseecho $txtin the custom-page.php drops “Ruby” onto my page (just on a page, not in tablepress table))Please advise
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] cell shortcode generated by phpHi Tobias
Thanks for your reply.
The
$txtlives in my custom-page.php template. Yes indeed –$txtcontains[table-cell id=1 cell=D2/]. I need to pass this schortcode to a cell in one table so that then data gets pulled from another table. How can I evaluate the Shortcode / what steps required for this please? New to this and interested in the most efficient way.Re:
[my-var], did did you mean I shall input[$txt]into the cell? If yes, then some concerns: 1)this did not bring up the Shortcode (tried[$txt]and[txt]what am I doing wrong?). 2)I am not sure if this is fit for purpose. Please note my end goal is for the shortcode, once it’s successfully passed, is to trigger data pull from another dable. Please share more info if this would be the most efficient way?