The Joomla! Forum ™





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Oct 03, 2007 7:50 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 22, 2007 8:41 am
Posts: 23
Location: Germany
Hi there,

I thought a snippets thread with many small code examples of specific problems would come handy for many developers out there starting with Joomla 1.5 development.

So, don't let discuss us here but post snippets new or collected ones from the forums !



PLEASE DISCUSS ABOUT THIS THREAD IN ANOTHER THREAD, THIS ONE SHOULD BE ONLY FOR POSTING CODE.



Thanx in advance,

Alex

_________________
o | polyvision


Top
 Profile  
 
PostPosted: Wed Oct 03, 2007 7:56 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 22, 2007 8:41 am
Posts: 23
Location: Germany
Using JHTML to display calendar input , dates etc:

When I looked through the joomla api reference to implement a calendar input field, I was wondering how I could do that 'cause in the joomla source code I found JTHML:_(bla bla) all over the place.. but the API reference told me something different about the usage of JHTML. However, after talking with people from the J!101-SkypeChat I got the answer. Here's the snippet to create a calendar input field in your template / form:
Code:
<?php echo JHTML::_( 'calendar',$value,$name,$id); ?>


Using this way, you can use the other methods of JHTML as well. Have a look at this api doc for further information: http://api.joomla.org/svn/Joomla-Framework/HTML/JHTML.html#calendar

thanx to Ian MacLennan from J101 Chat

Bye, Alex  :pop

_________________
o | polyvision


Top
 Profile  
 
PostPosted: Wed Oct 03, 2007 8:34 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 22, 2007 8:41 am
Posts: 23
Location: Germany
Using JPane and laoding templates from within a template:

Well, let us assume our template is called form.php. My template holds this code to create a pane and to display some content in the pane:
Code:
<?php
jimport('joomla.html.pane');

/* creating the pane */
$pane =& JPane::getInstance('tabs'); // change "tabs" to "sliders" or other way round to get the different behaviour

/* creating a content area */
echo $pane->startPane("somecontent-area");

echo $pane->startPanel("panel-name-one","panel1_id");
echo $this->loadTemplate("some-content");
echo $pane->endPanel();

echo $pane->startPanel("panel-name-two","panel2_id");
echo "some content for panel two";
echo $pane->endPanel();

echo $pane->endPane();
?>


The "difficult" thing to remember is, if you want to load a template from within a template... your template to be loaded has to be named like "your-current-template"_"template-to-be-loaded.php"

e.g.

my current template is called form.php
the template to be loaded is form_some-content.php

I load it in form.php by calling
Code:
echo $this->loadTemplate("some-content");

in the above example

Hope this helped someone,

bye Alex

_________________
o | polyvision


Top
 Profile  
 
PostPosted: Wed Oct 03, 2007 4:52 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 22, 2007 8:41 am
Posts: 23
Location: Germany
Using JButton in your component:

Here's a small snippet for using JButton and it's derived classes in your component.

Code:
<?php
jimport('joomla.html.toolbar.button.popup');

// creating a popup button, however the menus etd are still getting displayed in the menu (how can we change that??)

$popupbutton = new JButtonPopup();
echo $popupbutton->fetchButton( $type='Popup', $name = 'some-popup-button', $text = 'hello', $url = 'http://www.some-link.de', $width=640, $height=480, $top=0, $left=0 );
 ?>

_________________
o | polyvision


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 



Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group