Google Translate gadget seems to conflict with Concrete5
I'm new to website designing. I'm using Concrete5 for designing a page, but whe开发者_StackOverflow社区n I enter the Google Translate code, the page becomes difficult to edit. The blocks are not highlighted in the correct way when I put the mouse over them in the edit mode. It´s like the blocks were below their actual position. I used the Google Translate code with my Analytics account and multi-language.
I've never actually had a site doing that, but you can do something like the following in your template:
/yourtheme/elements/header.php:
<?php
Loader::element('header_required');
$u = new User();
if(!$u->isRegistered()) { // this will only happen if you aren't logged in
echo '<script... google translate code....>/script>';
}
The basic logic being to not include the translate code if you are logged in. This can be changed to not-in-edit-mode if that is closer to your use case(s).
Your best bet it to ask this and other questions on the concrete5 site:
http://www.concrete5.org/r/-/13433 - Quite a few nice developer article/how-to's here.
Forums at at: http://www.concrete5.org/community/forums/
Hope that helps - John Steele
I think the best approach is to disable the translate code while the user is in "edit mode" (not just when they're registered as @John suggests in his answer). Like so:
<?php if (!$c->isEditMode()): ?>
<script... google translate code...</script>
<?php endif; ?>
精彩评论