English 中文(简体)
1. 将文字与magento相结合
原标题:Integrating wordpress with magento

我试图将文字压缩纳入一个马根托安装,但在试图包括以下错误时,却不断发现:

致命错误: Cannot redeclare __()

我假设这一点,是因为玉米和言词都使用。

如何做到这一点。

我曾尝试过这样的事情:

if(!function_exists( __() )) {
    function __() {}
}

在magento和文字表达档案中,它没有任何区别——赋予我完全理解自己做什么。

是否有任何建议要围绕这一点?

问题回答

修改如下:

if(!function_exists( __ )) {
    function __() {}
}

你可以修改你的语言。 这使你能够方便地融入“语言”和“Magento”。 我利用SSH进入服务器,进入博客目录。 当时,我有以下指挥:

grep -rl  __(  * | xargs sed -i  s/__(/__wp(/g 

这使我能够把所有提及“<>功能”的内容改为_wp,而不再重新界定错误。

在使用这种方法时,有一些问题需要了解:

  1. I would keep the commands handy in a file for running it after you have done any type of installation or upgrade since any type of code modification on your system could potentially bring it down with errors.
  2. I would not recommend using this approach where you do not have full control of the WordPress installation. You really need to have control over this to make sure you don t bring the site down or that someone else doesn t inadvertently cause a problem.

我的升级方法是:

  1. Redirect all traffic from the blog using (mod_rewrite)
  2. Perform the upgrade(s)
  3. Test
  4. Disable redirects to allow traffic through again

这对我来说是好的。

http://www.technickels.com/2009/12/wordpress-integration-with-magento/

如前所述,之所以出现这一问题,是因为两个框架都确定了相同的功能(__(>)。 为了解决这些问题,你需要删除其中一项声明(或将其列为所列条件)。 联合会在这两个框架中都是相同的功能,但如果其中任何一个都履行这一职能,你将需要将其中一项声明移至另一个职能(即:<>>)并重新确定现行法典。 这是一个坏的想法。

这实际上是一个很好的例子,说明为什么不容易将言论和Magento混为一谈。 我的第一项建议是,绕过这一条,将保持两个法典库的长度,并尽可能利用改写法来考虑将其纳入。 否则,根据要求,使用在其他地方安装的“灯塔”,管理员额,并用一个包裹收集数据库信息。

当编码基数发生变化(例如,您升级)时,如果把两个编码基数合并起来,就可能给你带来许多成像。

希望帮助!

Thanks, Joe





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签