mercredi 11 septembre 2013

Google Map bug d'affichage sur Joomla 3

Google map présente des bugs d'affichage sur le Template par defaut (protostar , basé sur bootstrap) de joomla 3 , protostar (basé sur bootstrap) , pour y remdier , rien de plus simple, ajouter ces lignes a votre feuille de style : 

#map-canvas img {
max-width: none;
}

#map-canvas label {
width: auto; display:inline;
}

NB : #map-canvas est l'id du div conteneur de votre carte google map

mardi 2 juillet 2013

Logout link for Joomla 1.5, 2.5 and 3.0

Joomla 1.5 Logout Link

<?php
$returnURL = base64_encode(JURI::root() . "");
$user =& JFactory::getUser();
echo 'Hi,'.$user->username;
?>
<a href="index.php?option=com_user&task=logout&return=<?php echo $returnURL; ?>">
<input type="button" name="Submit" class="button" value="Logout"></a>

Joomla 2.5 Logout Link


<a href="index.php?option=com_users&task=user.logout&<?php echo JUtility::getToken(); ?>=1">
<input type="button" name="Submit" class="button" value="Logout">
</a>


Joomla 3.0 Logout Link

//JUtility::getToken() has been removed in Joomla 3.0. Use JSession::getFormToken() instead.

<a href="index.php?option=com_users&task=user.logout&<?php echo JSession::getFormToken(); ?>=1">
<input type="button" name="Submit" class="button" value="Logout">
</a>

mercredi 17 avril 2013

Raccourcis netbeans pratique

Note : 

pour les raccourcis de type "Ctrl-U, U "
taper ctrl + u , ensuite relacher et taper u 

Scrolling and Selecting

Keys Action
Ctrl-down arrow Scrolls the window up without moving the insertion point.
Ctrl-up arrow Scrolls the window down without moving the insertion point.
Ctrl-[ Moves the insertion point to the highlighted matching bracket. This shortcut only works when the insertion point is immediately after the opening or closing bracket.
Ctrl-Shift-[ Selects the block between a pair of brackets. This shortcut only works when the insertion point is imtmediately after either the opening or closing bracket.
Ctrl-G Jumps to any specified line.
Ctrl-A Selects all text in the file.

Modifying Text

Keys Action
INSERT Switches between insert text and overwrite text mode.
Ctrl-Shift-J Opens the Internationalize dialog box that you can use to insert an internationalized string at the insertion point.
Ctrl-U, U Makes the selected characters or the character to the right of the insertion point uppercase.
Ctrl-U, L Makes the selected characters or the character to the right of the insertion point lowercase.
Ctrl-U, S Reverses the case of the selected characters or the character to the right of the insertion point.

Code Folding

Keys Action
Ctrl-Minus (-) Collapses the block of code the insertion point is on.
Ctrl-Plus (+) Expands the block of code the insertion point is next to.
Ctrl-Shift-Minus (-) Collapses all blocks of code.
Ctrl-Shift-Plus (+) Expands all blocks of code.

Cutting, Copying, Pasting, and Deleting Text

Keys Action
Ctrl-Z (Undo) Reverses (one at a time) a series of editor actions, except Save.
Ctrl-Y (Redo) Reverses (one at a time) a series of Undo commands.
Ctrl-X (Cut) Deletes the current selection and places it into the clipboard.
Shift-Delete (Cut) Deletes the current selection and places it into the clipboard.
Ctrl-C (Copy) Copies the current selection to the clipboard.
Ctrl-Insert (Copy) Copies the current selection to the clipboard.
Ctrl-V (Paste) Pastes the contents of the clipbard at the insert point.
Delete (Delete) Deletes the current selection.
Ctrl-E Deletes the current line.
Ctrl-U Deletes text in the following sequence:
  • text preceding insertion point on same line
  • indentation on same line
  • line break
  • text on previous line
Ctrl-Backspace Removes the text in the current word preceding the insertion point.

Searching for Text

Keys Action
Ctrl-F3 Searches for the word the insertion point is on and higlights all occurrences of that word.
F3 Selects the next occurrence of the word in your current search.
Shift-F3 Selects the previous occurrence of the word in your current search.
Alt-Shift-H Switches highlighting of search results on or off.
Ctrl-F Opens the Find dialog box.
Ctrl-H Opens the Find and Replace dialog box.

Setting Tabs

Keys Action
Tab Shifts all text to right of insertion point to the right.
Alt-Shift-Right Shifts text in line containing the insertion point to the right.
Alt-Shift-Left Shifts text in line containing the insertion point to the left.

Using Bookmarks

Keys Action
Ctrl-Shift-M Sets or unsets a bookmark at current line.
Ctrl-Shift-Period/Comma Goes to next/previous bookmark.
source

jeudi 11 avril 2013

Utiliser plusieurs model dans mvc joomla

le fonctionnement par defaut , c'est que dans la vue on met ca :

$defaultModel = $this->getModel()

pour avoir un autre model , en principe il faut ajouter ce code :

$otherModel = $this->getModel('myothermodel')

et vous aurez une belle erreur :D
il vous faut ajouter ce code dans la methode display() de votre controlleur

$view = $this->getView('myview', 'html') ;
$view->setModel( $this->getModel( 'myothermodel' )) ;


NB :
il faut respecter les regles de nommage des fichiers joomla (en minuscule) sinon ca risque de ne pas marcher

mardi 19 février 2013

Jquery plugin pour Joomla

Un petit plugin pour démarrer le développement jquery sous joomla en 5s chrono :)

http://www.simplifyyourweb.com/index.php/downloads/category/8-loading-jquery


mardi 18 décembre 2012

Envoie d'un mail depuis joomla!

// recuperation de l'objet mailer
$mailer = JFactory::getMailer();
//recuperation de la configuration
$config = JFactory::getConfig();
// recupertation de la config mailfrom
$sender = array( 
    $config->getValue( 'config.mailfrom' ),
    $config->getValue( 'config.fromname' ) );
 
$mailer->setSender($sender);
$user = JFactory::getUser();
$recipient = $user->email;
 
$mailer->addRecipient($recipient);
// si plusieur destinataires 
$recipient = array( 'person1@domain.com',
 'person2@domain.com',
 'person3@domain.com' );
 
$mailer->addRecipient($recipient);

// creation du mail
$body   = "Your body string\nin double quotes if you want to parse the \nnewlines etc";
$mailer->setSubject('Your subject string');
$mailer->setBody($body);
// Optional file attached
$mailer->addAttachment(JPATH_COMPONENT.DS.'assets'.DS.'document.pdf');
// si mail html
$body   = '<h2>Our mail</h2>'
    . '<div>A message to our dear readers'
    . '<img src="cid:logo_id" alt="logo"/></div>';
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setBody($body);
// Optionally add embedded image
$mailer->AddEmbeddedImage( JPATH_COMPONENT.DS.
'assets'.
DS.
'logo128.jpg',
 'logo_id',
 'logo.jpg',
 'base64',
 'image/jpeg'
 );

//envoie du mail
$send = $mailer->Send();
if ( $send !== true ) {
    echo 'Error sending email: ' . $send->message;
} else {
    echo 'Mail sent';
}

vendredi 23 novembre 2012

snippets jquery

Hover On/Off
$("a").hover( function () { // code on hover over }, function () { // code on away from hover } );

Prevent Anchor Links from Loading
$("a").on("click", function(e){ e.preventDefault(); });

Scroll to Top
$("a[href='#top']").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; });

Ajax Template
$.ajax({ type: 'POST', url: 'backend.php', data: "q="+myform.serialize(), success: function(data){ // on success use return data here }, error: function(xhr, type, exception) { // if ajax fails display error alert alert("ajax error response type "+type); } });

Animate Template
$('p').animate({ left: '+=90px', top: '+=150px', opacity: 0.25 }, 900, 'linear', function() { // function code on animation complete });

Toggle CSS Classes
$('nav a').toggleClass('selected');

Toggle Visibility
$("a.register").on("click", function(e){ $("#signup").fadeToggle(750, "linear"); });

Loading External Content
$("#content").load("somefile.html", function(response, status, xhr) { // error handling if(status == "error") { $("#content").html("An error occured: " + xhr.status + " " + xhr.statusText); } });

Keystroke Events
$('input').keydown(function(e) { // variable e contains keystroke data // only accessible with .keydown() if(e.which == 11) { e.preventDefault(); } }); $('input').keyup(function(event) { // run other event codes here });

Equal Column Heights
var maxheight = 0; $("div.col").each(function(){ if($(this).height() > maxheight) { maxheight = $(this).height(); } }); $("div.col").height(maxheight);

Append New HTML
var sometext = "here is more HTML"; $("p#text1").append(sometext); // added after $("p#text1").prepend(sometext); // added before

Setting & Getting Attributes
var alink = $("a#user").attr("href"); // obtain href attribute value $("a#user").attr("href", "http://www.google.com/"); // set the href attribute to a new value $("a#user").attr({ alt: "the classiest search engine", href: "http://www.google.com/" }); // set more than one attribute to new values

Retrieve Content Values
$("p").click(function () { var htmlstring = $(this).html(); // obtain html string from paragraph $(this).text(htmlstring); // overwrite paragraph text with new string value }); var value1 = $('input#username').val(); // textfield input value var value2 = $('input:checkbox:checked').val(); // get the value from a checked checkbox var value3 = $('input:radio[name=bar]:checked').val(); // get the value from a set of radio buttons

Traversing the DOM
$("div#home").prev("div"); // find the div previous in relation to the current div $("div#home").next("ul"); // find the next ul element after the current div $("div#home").parent(); // returns the parent container element of the current div $("div#home").children("p"); // returns only the paragraphs found inside the current div

source