First rather than changing the default theme use a child theme as your changes will be lost if The next WordPress upgrade included the theme, as the upgrade deletes the files and re-writes them.
Once you have that sorted then You need the full path!
get_stylesheet_directory_uri() will find the url for the theme.
[php debug=0]
include_once(get_stylesheet_directory_uri() .'/vcube/visualcube.php?fmt=gif&size=200&view=plan&case=RURURU2RURUR2U2Ry2&arw=U1U5,U5U1,U3U7,U7U3');
[/php]
Hi,
I created a child theme in /wp-content/themes/vcube
I created the style.css file to contain
/*
Theme Name: Twenty Eleven Child
Theme URI: http: //example.com/
Description: Child theme for the Twenty Eleven theme
Author: Your name here
Author URI: http: //example.com/about/
Template: twentyeleven
Version: 0.1.0
*/
@import url("../twentyeleven/style.css");
It messes with the parent style (as stated in the child theme link you gave, but I thought as long as I did’nt add anything to the child the parent should still be valid via the @import url tag. Now the logo is gone for instance…
Anyway,
I use the code you gave me
[php debug=0]
include_once(get_stylesheet_directory_uri() .'/vcube/visualcube.php?fmt=gif&size=200&view=plan&case=RURURU2RURUR2U2Ry2&arw=U1U5,U5U1,U3U7,U7U3');
[/php]
But I now get these errors
Warning: include_once() [function.include-once]: URL file-access is disabled in the server configuration in /home/c/cubeloop/cubeloop/cubeloop.com/www/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(50) : eval()'d code on line 2
Warning: include_once(http://cubeloop.com/wp-content/themes/vcube/vcube/visualcube.php?fmt=gif&size=200&view=plan&case=RURURU2RURUR2U2Ry2&arw=U1U5,U5U1,U3U7,U7U3) [function.include-once]: failed to open stream: no suitable wrapper could be found in /home/c/cubeloop/cubeloop/cubeloop.com/www/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(50) : eval()'d code on line 2
Warning: include_once() [function.include]: Failed opening 'http://cubeloop.com/wp-content/themes/vcube/vcube/visualcube.php?fmt=gif&size=200&view=plan&case=RURURU2RURUR2U2Ry2&arw=U1U5,U5U1,U3U7,U7U3' for inclusion (include_path='.:/usr/local/php5/share/pear') in /home/c/cubeloop/cubeloop/cubeloop.com/www/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(50) : eval()'d code on line 2
It makes no sense to me
/Dennis
If you want to include the script then do it in the child themes functions.php and not in a page or post, includes are ok in the functions.php.
function get_visualcube() {
if( is_singular() ) {
include_once(get_stylesheet_directory_uri() .'/vcube/visualcube.php?fmt=gif&size=200&view=plan&case=RURURU2RURUR2U2Ry2&arw=U1U5,U5U1,U3U7,U7U3');
}
}
In the page call the function?
[php debug=0]
get_visualcube();
[/php]
HTH
David
Hi David,
I’m at work and don’t have access to upload the file to the server right now. I will check it later tonight.
BUT, I don’t think it will work since the arguments passed to the visualcube.php will change for every image I create
For instance a 3d view of the rubiks cube with the moves RUR’ (*) applied to it will look like http://cube.crider.co.uk/visualcube.php?fmt=gif&size=200&alg=RUR’
a top view of the cube were you have to orient the 4 corners and permute the for edges will look like http://cube.crider.co.uk/visualcube.php?fmt=gif&size=200&view=plan&case=RUR’U’R’U2RUR’UR2U2R’y2&arw=U1U5,U5U1,U3U7,U7U3
I also think I will have problems with the single quote (‘) in the parameters above, but I think that \’ will do the trick?
The reason is that I want the script to generate different cases for me as .png or .gif instead of spending lot of time photoshop’ing
* It’s rubiks cube notation where R is the right face and U is the upper face. R is clockwise, R’ is counterclockwise
Hi,
the only thing that happens is that
function get_visualcube() { if( is_singular() ) { include_once(get_stylesheet_directory_uri() .’/vcube/visualcube.php?fmt=gif&size=200&view=plan&case=RURURU2RURUR2U2Ry2&arw=U1U5,U5U1,U3U7,U7U3′); } }
is output on the top of the screen
/Dennis
It requires database tables and a connebt for the visualcube, not sure if it is for WordPress.
I created a test function and passed in arguments, but it is looking for a database connection in the visualcube file.
I added the localhost database connections then got table errors, so it looks like you will need to do some more digging!
Here is my code for functions.php
[Code moderated as per the Forum Rules. Please use the pastebin]
HTH
David
HaHa!
After all that someone has already turned it into a wordpress plugin!
http://www.vanderblonk.com/tools/wordpress-rubik-plugin/
If that works, please mark this one resolved!
HTH
David
Hi David,
figured it out! 🙂
I thought like this, the .php file creats an image. Then I inserted the file and parameters within the <img> tag. like
<img src="http://www.cubeloop.com/vcube/visualcube.php?fmt=png&size=200&view=plan&bg=t&case=RUR'U'R'U2RUR'UR2U2R'y2&arw=U1U5,U5U1,U3U7,U7U3"/>
I also moved the file outside WP and deleted the child theme. In the visualcube.php file I noticed that it calls for image caching (mysql requests), but since my site will not generate many hits (…) I modified the value $ENABLE_CACHE to false. Now it works like a charm.
I also did try the vanderblonk plugin. It work out of the box! It has not as many options like the other one. I will have to dig deeper of which is best suited for me. There is also a third option http://software.rubikscube.info/icube/ which I have not tried yet
Thanks for all the help and effort you have given me, truly appriciated
/Dennis