friends
my problem is : my project is on codeigniter. when i refresh my page first html content loaded and after some seconds that pages js and css loaded. for that i tried carabiner.
step 1: i downloaded carabiner
step 2: i added it to app/third_party/carabiner/
step 3: now i add group in app/third_party/carabiner/config/carabiner.php
like this-
$config['groups']['custom_js'] = array('js' => array(array('base_url();/assets/js/jquery.js','base_url();/assets/js/jquery.min.js', TRUE, FALSE)));
$this->carabiner->display('custom_js');/* for load that group */
$carabiner_config = array(
'script_dir' => 'assets/scripts/',
'style_dir' => 'assets/styles/',
'cache_dir' => 'assets/cache/',
'base_uri' => base_url(),
'combine' => TRUE,
'dev' => FALSE,
'minify_js' => TRUE,
'minify_css' => TRUE
);
i also set this array in config/carabiner.php but dont know what is
problem still showing error due to missing jquery.min.js and
jquery.js any suggestion ??
You assign the base_url() like string. So replace above coding like this
$config['groups']['custom_js'] = array(
'js' => array(
array(base_url().'/assets/js/jquery.js', base_url().'/assets/js/jquery.min.js', TRUE, FALSE)
)
);
Related
I am using Concrete5 5.7.5.2 as my CMS and decided to try using CKEditor instead of the shipped Redactor. The problem I am having is that anytime I try to insert a content block it wraps a paragraph tag around my content.
I have tried the following settings in my config.js, but they don't seem to change the problem.
config.autoParagraph = false;
config.enterMode = 2;
config.enterMode = CKEDITOR.ENTER_BR // pressing the ENTER Key puts the <br/> tag
config.shiftEnterMode = CKEDITOR.ENTER_P; //pressing the SHIFT + ENTER Keys puts the <p> tag
Part of the reason I am using CKEditor instead of Redactor is because this is the exact issue I had with Redactor. I tried all of the recommended fixes in Redactor as well, and it didn't fix it there either. Could it be something beyond these two plugins? Core?
You help would be much appreciated.
open CKEditor.php (/src/Editor)
look for this code block
$options = array_merge(
$options,
array(
'plugins' => implode(',', $plugins),
'stylesSet' => 'concrete5styles',
'filebrowserBrowseUrl' => 'a',
'uploadUrl' => (string)URL::to('/ccm/system/file/upload'),
'language' => $this->getLanguageOption(),
'customConfig' => '',
'allowedContent' => true,
'image2_captionedClass' => 'content-editor-image-captioned',
'image2_alignClasses' => array(
'content-editor-image-left',
'content-editor-image-center',
'content-editor-image-right'
)
)
);
add these two key value pairs
'enterMode' => 2,
'shiftEnterMode' => 2
the code should look like this afterward
$options = array_merge(
$options,
array(
'plugins' => implode(',', $plugins),
'stylesSet' => 'concrete5styles',
'filebrowserBrowseUrl' => 'a',
'uploadUrl' => (string)URL::to('/ccm/system/file/upload'),
'language' => $this->getLanguageOption(),
'customConfig' => '',
'allowedContent' => true,
'image2_captionedClass' => 'content-editor-image-captioned',
'image2_alignClasses' => array(
'content-editor-image-left',
'content-editor-image-center',
'content-editor-image-right'
),
'enterMode' => 2,
'shiftEnterMode' => 2
)
);
I created a module then use upgrade script to add a multiselect attribute. the attribute is using 'source' to get it values dynamically. the code is the following:
Add Attribute:
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
$installer->startSetup();
$productEntityId = $installer->getEntityTypeId('catalog_product');
$allAttributeSetIds = $installer->getAllAttributeSetIds($productEntityId);
$installer->addAttribute('catalog_product', 'badge',array(
'label' => 'Badge',
'type' => 'varchar',
'input' => 'multiselect',
'backend' => 'eav/entity_attribute_backend_array',
'frontend' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => false,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'source' => 'module/entity_attribute_source_superbadge_config',
'visible_on_front' => false,
'visible_in_advanced_search' => false,
'unique' => false ));
$attributeId= $installer->getAttributeId($productEntityId, 'badge');
//add to General Group of all attribute sets
foreach($allAttributeSetIds as $attributeSetId) {
$installer->addAttributeToSet($productEntityId, $attributeSetId, 'General', $attributeId);
}
$installer->endSetup();
The Source is:
class Module_Model_Entity_Attribute_Source_Superbadge_Config extends Mage_Eav_Model_Entity_Attribute_Source_Boolean
{
/**
* Retrieve all attribute options
*
* #return array
*/
public function getAllOptions()
{
if (!$this->_options) {
$superbadge = array();
$badges = Mage::getModel('module/rule')->getCollection()->getSuperBadge();
foreach ($badges as $badge){
$superbadge[] = array('label' => $badge->getName(),
'value' => $badge->getId());
}
$this->_options = $superbadge;
}
return $this->_options;
}
}
The code is working fine am able to retrieve the value dynamically but the problem when the module is disable it is throwing an error directory could not found when am creating a new product in admin.
error:
Warning: include(Mage\Module\Model\Entity\Attribute\Source\Superbadge\Config.php) [function.include]: failed to open stream: No such file or directory in C:\Sites\project\development\lib\Varien\Autoload.php on line 93
Is there a way to prevent this error when the module is disable? i dont want to do uninstall as i will lost all data in my db. Thanks for any guide or help you may provide me..
The issue is because it is already save in db - eav attribute table.
One solution that i implemented is to add a button using system xml for the module. add a script to empty the source model field in the database when click the button.
click on the button everytime you need to disable the module.
the more important is to add one more button to add the source model in the database when you want to enable the module.
hope this solution will help someone who come accross this issue.
First of all did you flush the cache after you disabled the module?
Or maybe it's an compilation error? Try this out.
Try to track down where exactly the issue is coming up with a call of mageDebugBacktrace() in /lib/Varien/Autoload.php on line 93.
Let me know if some of the above worked for you!
I want to get the selected schoolFilter form value and place in [SELECTED VALUE HERE].
$data = $this->Js->get('#SchoolFilter')->serializeForm(array('isForm' => true, 'inline' => true));
$this->Js->get('#SchoolSchoolId')->event(
'change', $this->Js->request(
array('action' => 'assign_school_ads/', [SELECTED VALUE HERE], array(
'update' => '#results',
'data' => $data,
'async' => true,
'dataExpression' => true,
'method' => 'POST'
)
)
);
// School Filter
$schoolFilter = $this->Form->create('School', array('id' => 'SchoolFilter');
$schoolFilter .= $this->Form->input('school_id', array('label'=>'Schools', 'empty'=>'- select -');
$schoolFilter .= $this->Form->end();
I have seen variations on this question but without any clear answer, except to just forget using JS Helper. Is it possible within the context of JS Helper? And if not, can I get the value using regular JQuery, then inject it into JS Helper.
Use following code :-
$this->Js->get('#SchoolFilter');
$this->Js->event('change', $this->Js->request(array('controller'=>'put-ur-controller-ame-here','action' => 'assign_school_ads'),array('async' => true,'update' => '#results','method' => 'post','dataExpression'=>true,'data'=> $this->Js->serializeForm(array('isForm' => true,'inline' => true)))));
the serialize() function sends the form data to the php action so we can see which option was selected and decide what to update in the ajax call.
the form data will be found in $this->data in the action (just like after a form has been submited).
Don't forget to add $this->Js->writeBuffer(); in your layout just before the body closing tag. Otherwise all the ajax code will not be added to your page.
When using a cms page in magento I sometimes need an empty content section. Most times this is for my homepage. But magento forces me to put something in content before it can be saved.
Is there a way to get magento to allow empty cms page content?
You can use an empty div or span
The Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Content::_prepareForm() method dispatches the adminhtml_cms_page_edit_tab_content_prepare_form event. You can observe this event, grab the field from the form object which is passed into the event, and change its required property to false.
This is a quick and dirty fix, you should really override the admin class so you won't lose the change when you next upgrade.
Anyways, in file app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php, in function _prepareForm(), line 82, change:
$contentField = $fieldset->addField('content', 'editor', array(
'name' => 'content',
'style' => 'height:36em;',
'required' => true,
'disabled' => $isElementDisabled,
'config' => $wysiwygConfig
));
to
$contentField = $fieldset->addField('content', 'editor', array(
'name' => 'content',
'style' => 'height:36em;',
'required' => false,
'disabled' => $isElementDisabled,
'config' => $wysiwygConfig
));
add <div></div> inside your empty elements to stop magento cms from removing them
Its not particularly elegant, but you can just enter and/or hide the content via CSS
I'm trying to get an AJAX-submitted (AHAH) form working to display in a block on the sidebar. For testing purposes, I'm using an example module called "Poof" from the Pro Drupal Development book: http://books.google.com/books?id=VmZrdGuBZCMC&lpg=PA269&ots=cnHiYG6kXn&dq=pro%20drupal%20development%20poof&pg=PA269#v=onepage&q=pro%20drupal%20development%20poof&f=false
The only thing I've added to the example so far is an implementation of hook_block, which looks like this:
function poof_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('poof');
return $blocks;
case 'view':
$block['content'] = drupal_get_form('poof_form');
return $block;
}
}
The AJAX module works fine when displaying on its own page (mydrupalsite.com/poof) but when I call the form with module_invoke('poof', 'block' ...) in a template file, the form submits as normal (sans AJAX) and refreshes the page.
I can't find a definitive answer for why this happens, though a found something tangentially related that suggests that maybe AHAH doesn't work within blocks. If that's so, why? Or better yet, what's a work-around. Do I have to put the on its own blank page and bring it in with an iframe? That sounds unnecessarily messy.
UPDATED:
Here's more code for reference (again, it's from the Pro Drupal book)
function poof_form() {
$form['target'] = array(
'#type' => 'markup',
'#prefix' => '<div id="target">',
'#value' => t('Click the button below.'),
'#suffix' => '</div>',
);
$form['submit'] = array(
'#type' => 'button',
'#value' => t('Click Me'),
'#submit'=>false,
'#ahah' => array(
'event' => 'click',
'path' => 'poof/message_js',
'wrapper' => 'target',
'effect' => 'fade',
),
);
return $form;
}
function poof_message_js() {
$output = t('POOF!');
drupal_json(array('status' => TRUE, 'data' => $output));
}
Try adding
$blocks[0]['cache'] = BLOCK_NO_CACHE;
to your hook_block implementation.
Rendering a form with ahah causes a call to drupal_add_js to add the ahah javascript, but while the output of the block is cached, the javascript that gets added to the page doesn't.