2016-11-21 45 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

相關問題