jonowinn
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Tutorial: Currently playing song – \"Kung-Tunes\"Hey, GJ, I think I might be able to help. I had the same problem for a couple of days, but I just came across a fix, and I think it might work for you.
Here’s the problem: the trackinfo.txt file is in the root of the wordpress directory, and for some reason, wordpress doesn’t like that. It won’t allow the file to be accessed. If you try to view the file in your browser, rather than requesting it in a php script, it just takes you to your homepage. So, the fix is this: make a folder (I called mine “kung,” but you can do whatever makes sense to you) in your wordpress/wp-content/plugins/ folder, and tell Kung to put the file there, rather than your root directory. Now you just have to edit the path for “fopen” in your PHP file.
Here’s how I do mine
<?php
/*
Plugin Name: My iTunes
Plugin URI: https://chrisjdavis.org/index/category/wp-hacks/
Description: A plugin that parses the text file created by Kung-Tunes
and displays it on your site.
Author: Chris J. Davis
Author URI: https://chrisjdavis.org/
*/
function display_tunes() {
$fp=fopen(“https://s90251085.onlinehome.su/Fagatrodle/wp-content/plugins/kung/trackinfo.txt”,”r”);
$track=fgets($fp,1024);
echo “$track”;
fclose($fp);
}
?>You should probably use an absolute path, like I did, just to be on the safe side.
The function doesn’t change, so you still type “<?php display_tunes() ?>” wherever you want it. I have it in my sidebar, right above the meta functions.
Forum: Installing WordPress
In reply to: WordPress and 1and1 – Localhost for the DB?I installed on my 1and1 server, and it works fine. Your problem is that you didn’t remove the example values. It needs to look like this:
<?php
// ** MySQL settings ** //
define(‘db151107765’); // The name of the database
define(‘dbo151107765’); // Your MySQL username
define(‘XXXXXX’); // …and password
define(‘db266.perfora.net’); // 99% chance you won’t need to change this value// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-includes/languages.
// For example, install de.mo to wp-includes/languages and set WPLANG to ‘de’
// to enable German language support.
define (‘WPLANG’, ”);/* That’s all, stop editing! Happy blogging. */
define(‘ABSPATH’, dirname(__FILE__).’/’);
require_once(ABSPATH.’wp-settings.php’);
?>You had multiple values returned, you need to just list the real ones.