我在 atk4 博客http://agiletoolkit.org/blog/integrating-agile-toolkit-with-wordpress/上找到了一篇文章,我按照说明进行操作,但出现错误,它说找不到 ApiWeb 类。然后我查看了您下载的真实框架的 index.php,它初始化所有内容的方式与博客文章的初始化方式不同。我想知道是否可以集成 ATK4 或者我做错了什么?
1 回答
I'm also currently integrating a wordpress site with ATK4 at the moment.
The ApiWeb.php class is present in the atk4/lib directory in both 4.2 and 4.1.3 versions of atk4 so not sure why you are getting an error.
What is suggested on the blog page about integrating ATK4 with wordpress is that you would load the ATK4 libraries as php embedded in the pages so you would need to ensure you change the include line based on where you have placed the atk4 files.
<?php
include 'atk4/loader.php';
$api=new ApiWeb('sample_project');
$api->add('jUI');
.. .. ..
$api->execute();
?>
I havent tried this but think you would need to verify the path to ATK4 is correct.
I've taken a different approach to integrating Wordpress and ATK4 - rather than embedding ATK4 into the pages as per the blog article you referenced, i'm going with installing wordpress in one installation and ATK4 in a separate one and using the same template in both.
The wordpress template i'm using is from themeforest and it came with a WP folder containing the Wordpress files plus a HTML folder that contains example pages. I took one of the HTML pages and created a new templates/default/shared.html inserting the atk4 tags such as in the appropriate places.
I've created a menu in Wordpress Theme->xxx->Menu which are mostly static pages from Wordpress and one menu option which is a link to the start of the ATK4 root. Because i'm using the same template, it looks like a single site. In my case, i'm not using the login functionality of Wordpress - all the wordpress pages will be accessible without logging in but i am using a dynamic second level menu and options based on the logged in user which will be defined in Frontend.php
The ATK4 menu gave me a problem because it wasnt consistent with the site and after a while trying to style the menus with CSS and create a submenu using Menu_Basic and Menu_Lite, i went with using ATK4 Views and split the HTML from the wordpress theme, to create a menu.html, a submenu.html and a menuitem.html and have set this using code in Frontend.php
It's still a work in progress so i can't provide the link at the moment as it's not online yet but it seems to be working and may give you other ideas depending on what you want to achieve with integrating ATK4 and Wordpress.
If you want to have a common login for ATK4 and Wordpress (using ATK4 to control the access each user has), there is a plugin for Wordpress that might help with external DB Auth so you could use this with the BasicAuth of ATK4 instead of using Wordpress Auth functionality.