For loop does not work with Wordpress plugin - php

I'm using this plugin in Wordpress to write php in a page but every time I use a for loop it gives me this error:
Parse error: syntax error, unexpected end of file, expecting ';'
How do I solve this?

This plugin does not work with loops. It is a known issue if you take a look at the reviews.
There is a plugin that I often use and that works perfectly. It is called WP-exec PHP.
Link here: https://wordpress.org/plugins/wp-exec-php/

Related

Laravel AdminLTE with Nwidart module menu option

I'm trying to call a module route from an AdminLTE submenu but it says:
syntax error, unexpected token ":", expecting "("
I'm writing at the top of file 'views/vendor/partials/sidebar/menu-item-link.blade.php' 2 lines but it is probably breaking with the first one:
#if( !isset($item['module']) || (Module::has($item['module']) )
And of course in the adminlte.php configuration file I add a 'module'=>'' to the menu item.
Am I doing something wrong?
thanks.
Hi and welcome to StackOverflow,
It seems there is an extra opening parenthesis in your code (the one before "Module").
Try with this instead:
#if( !isset($item['module']) || Module::has($item['module']) )
Thank you!
It's something I hate from PHP. I waste a lot of time with simple syntax errors.
It still doesn't work, but at least I found out it's not a Module system problem.

Fatal error : Cannot use [] for reading using smarty template

I am building a ticket support application, and the problem I am having since this weekend, is that when I head to the information page, I land onto the following error:
https://i.imgur.com/EzbxWe2.png
I looked this error up, and it seems to have to do with an array notation commonly seen as $arr = [$key][]
I have scanned my code at the lines of the error, and I cannot seem to trace why my page no longer shows. Underneath my Smarty template and the backend code running behind it:
Smarty Template: CallScreen.tpl
https://hastebin.com/pagubejesa.bash
CallScreen.php running on the background:
https://hastebin.com/ivezukahut.xml
RESOLVED
Error was that the local cache file was not updated, resulting in the error.

Fatal error caused by get_theme_mod()

I've been using the WordPress Customize.php functionality to allows users to customize my theme via the admin Customizer. It's been working fine offline in WAMP, but when I uploaded the theme to the testing server I received this message:
Fatal error: Can't use function return value in write context in [my url]/functions.php on line 181
The line it links to is a reference to get_theme_mod(), and in particular:
$page_data = get_page(get_theme_mod('page'));
Do I have to register the 'theme mods' in functions or something?
Right, I've found my issue - and another one has arose that I'm looking into...
For those that read this after searching the web having suffered the same problem, the reason I was receiving this error was because above this I was testing the get_theme_mod with an empty() function. Which, does not work as get_theme_mod is not a variable.
if(!empty(get_theme_mod('page'))){
$page_data = get_page(get_theme_mod('page'));
}

Can't get .php to output to the browser

I am completely new to coding and my current assignment is just to use a "here document" block. All the code I have for the program is:
<?php
$firstphpstring = <<<ONTOTHENEXTONE
I have now coded my first block to be displayed
in my very first web page.I am excited to see what the
next several weeks have in stored.
ONTOTHENEXTONE;
echo $firstphpstring;
?>
But I keep getting the following error:
Parse error: syntax error, unexpected T_SL in > C:\wamp\www\php_foothill\Week2Lab_CIS052N_heredoc_gettype.php on line 2
I am using Windows 7, WAMPServer 2.2, and have the .php file in a folder in C:\wamp\www
Remove the space after the <<<ONTOTHENEXTONE.

wordpress (301 redirect plugin)/ php question

I am setting up a website in wordpress. the site was done by someone else. After setting up the site / database I get the following error:
Parse error: syntax error, unexpected $end in C:\Documents and Settings\user101\
Desktop\wordpress\wp-content\plugins\wp-301redirect\wp-301redirect.php on
line 320
line 320 is the very last line of wp-301redirect.php page. I looked up what 301redirect is and it is apparently a plugin. The wp-301redirect.php page I have is exactly what the plugin provides (zip download). line by line.
Does anyone know what might be causing this.?
In the default file for this plugin. line 220 has <? it should be changed to <?php to fix this error
Try removing the last line after ?>. And generally it's advisable to not close your PHP with ?> as it's not required and prevents this from happening in the first place.
Most likely, a function or control block is missing its matching end-brace, such as:
function foo() {
//stuff
...
// EOF
OR
if (true) {
...
// EOF

Categories