2016-11-21 80 views
-3

我遇到了问题,我的网站。Php致命错误。如何将一个类包含到index.php中?

PHP Fatal error: Class 'innovation_ruby_util' not found in D:\inetpub\vhosts\example.com\httpdocs\wp-content\themes\innovation\index.php on line 7 

请帮我在代码中添加以下

<?php 
/** 
* Innovation created by ThemeRuby 
* This file display home layout 
*/ 
//get home options 

$ruby_options['page_layout'] = innovation_ruby_util::get_theme_option('home_layout'); 
$ruby_options['sidebar_name'] = innovation_ruby_util::get_theme_option('home_sidebar'); 
$ruby_options['sidebar_position'] = innovation_ruby_util::get_theme_option('home_sidebar_position'); 

$ruby_options['big_first'] = innovation_ruby_util::get_theme_option('big_post_first'); 

if ('default' == $ruby_options['sidebar_position']) { 
    $ruby_options['sidebar_position'] = innovation_ruby_util::get_theme_option('site_sidebar_position'); 
} 

//render featured area 
get_template_part('templates/section', 'featured'); 

//render home columns 
get_template_part('templates/section','columns'); 

//render layout 
innovation_ruby_blog_layout::render($ruby_options); 
+0

您需要[**'require_once' **](http://php.net/manual/en/function.require-once.php)。像'require_once(path-to-class-file)';' –

+0

我不知道php,请问你可以告诉我在index.php文件中添加这段代码的位置 – blacklisthackers

+0

你需要在所有页面中使用吗? –

回答

0

班我可以告诉你PHP核心方式。

<?php 
/** 
* Innovation created by ThemeRuby 
* This file display home layout 
*/ 
//get home options 

require_once("<path-to-class-file>"); 

$ruby_options['page_layout'] = innovation_ruby_util::get_theme_option('home_layout'); 
$ruby_options['sidebar_name'] = innovation_ruby_util::get_theme_option('home_sidebar'); 
. 
. 
. 
+0

仍然无法正常工作...你有其他选择吗? – blacklisthackers

+0

现在的错误是什么? –

+0

我加入这个代码 blacklisthackers

相关问题