Joomla! Discussion Forums



It is currently Wed Mar 17, 2010 5:38 am (All times are UTC )

 





Post new topic Reply to topic  [ 4 posts ] 
Author Message
Posted: Wed Jan 09, 2008 10:55 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Fri Aug 19, 2005 8:41 am
Posts: 801
Location: Afyonkarahisar-Türkiye | C* |
Bu yazımızdan itibaren artık birçok sınıf ve fonksiyonu bildiğimizi düşünerek ufak bir form oluşturmaya başlayacağız. Öncelikle bir HTML editörü ile kendimize bir form oluşturalım. Ben Dreamweaver ile kendime aşağıdaki gibi bir form oluşturdum;

Code:
<form action="index.php" method="post">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<th colspan="2">Joomla Türkiye Geri Bildirim Formu</th>
</tr>
<tr>
  <td width="50%">Adınız, Soyadınız:</td>
<td width="50%"><input type="text" name="isim" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
  <td>Kullanıcı Adınız:</td>
<td><input type="text" name="kullanici" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
  <td>E-posta Adresiniz:</td>
<td><input type="text" name="eposta" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
  <td>Mesajın Konusu:</td>
<td><input type="text" name="konu" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
  <td colspan="2">Mesajınız:</td>
</tr>
<tr>
  <td colspan="2"><textarea name="mesaj" cols="50" rows="15" class="inputbox"></textarea></td>
</tr>
</table>
<input type="hidden" name="option" value="com_form" />
<input type="hidden" name="task" value="gonder" />
<input type="submit" name="submit" value="Formu Gönder" class="inputbox" />
</form>


Bu formu inceleyecek olursak;

Code:
<form action="index.php" method="post">


Formun ilk satırında formun nereye ve hangi metod ile gönderileceğini belirttim.

Code:
<input type="hidden" name="option" value="com_form" />
<input type="hidden" name="task" value="gonder" />


Formun sonundaki son iki satırda option (yani bileşenin adı) olarak com_form olarak belirttim. Çünkü tüm herşeyi bitirdiğimizde bu form bileşeninin adı com_form olacak. Hemen altındaki satırda da form verilerinin gideceği fonksiyonu (gonder) belirttim.

Formdaki alanlara bakacak olursak;
- isim,
- kullanici,
- eposta,
- konu,
- mesaj


Şimdi bir yazı editörü ile php dosyamızı oluşturalım. Bileşenimizin adını com_form olarak adlandıracağımızı belirtmiştik. Dolayısıyla dosyanın adı form.php olacak.

form.php:

Code:
<?php
//direkt erişimi engelleyelim
defined('_VALID_MOS') or die('Kısıtlı erişim');

//task oluşturalım
switch($task) {
  //varsayılan fonksiyonumuz yani formumuzun gösterileceği yer
  default:
  Form();
  break;

  //form gonderildiğinde çalışacak olan fonksiyon (gonder fonksiyonu)
  case 'gonder':
  FormuGonder();
  break;
}

function Form() {
?>
<form action="index.php" method="post">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<th colspan="2">Joomla Türkiye Geri Bildirim Formu</th>
</tr>
<tr>
<td width="50%">Adınız, Soyadınız:</td>
<td width="50%"><input type="text" name="isim" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
<td>Kullanıcı Adınız:</td>
<td><input type="text" name="kullanici" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
<td>E-posta Adresiniz:</td>
<td><input type="text" name="eposta" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
<td>Mesajın Konusu:</td>
<td><input type="text" name="konu" value="" class="inputbox" size="30" /></td>
</tr>
<tr>
<td colspan="2">Mesajınız:</td>
</tr>
<tr>
<td colspan="2"><textarea name="mesaj" cols="50" rows="15" class="inputbox"></textarea></td>
</tr>
</table>
<input type="hidden" name="option" value="com_form" />
<input type="hidden" name="task" value="gonder" />
<input type="submit" name="submit" value="Formu Gönder" class="inputbox" />
</form>
<?php
}

function FormuGonder() {
//formdaki gonderilen verileri alalım
$isim = mosGetParam($_REQUEST, 'isim');
$kullanici = mosGetParam($_REQUEST, 'kullanici');
$eposta = mosGetParam($_REQUEST,'eposta');
$konu = mosGetParam($_REQUEST, 'konu');
$mesaj = mosGetParam($_REQUEST, 'mesaj');

//Burayı kendi mail adresinizle değiştirin!
$mailim = ' benimmailim@benimsitem.comBu mail adresi spam botlara karşı korumalıdır, görebilmek için Javascript açık olmalıdır ';

//Formu mosMail fonksiyonu ile kendi e-posta adresimize göndertelim
mosMail($eposta, $isim, $mailim, $konu, $mesaj);

//Bileşene geri gönderelim ve uyarı mesajımızı gösterelim
mosRedirect('index.php?option=com_form','Gönderiniz başarıyla iletildi');
}
?>



Şimdi gelelim bileşenin diğer dosyalarını oluşturmaya;

form.xml:

Code:
<?xml version="1.0" encoding="iso-8859-9"?>
<mosinstall type="component" version="1.0.0">
    <name>Form</name>
    <author>Soner Ekici</author>
    <creationDate>Temmuz 2007</creationDate>
    <copyright>(C) 2006 Soner Ekici. All rights reserved.</copyright>
    <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
    <authorEmail> pisdoktor@joomlaturkiye.org</authorEmail>
    <authorUrl>www.sonerekici.com</authorUrl>
    <version>1.0</version>
    <description>Bu bizim ilk form bileşenimiz.</description>
    <files>
    <filename>form.php</filename>
    </files>
<install>
</install>
<uninstall>
<queries>
</queries>
</uninstall>
<installfile>install.form.php</installfile>
<uninstallfile>uninstall.form.php</uninstallfile>
</mosinstall>



install.form.php:

Code:
<?php
defined( '_VALID_MOS' ) or die( 'Kısıtlı erişim' );

function com_install()
{
  
}
?>

uninstall.form.php:

Code:
<?php
defined( '_VALID_MOS' ) or die( 'Kısıtlı erişim' );

function com_uninstall()
{
  
}
?>


Şimdi elimizde 4 adet dosya oluştu;

- form.xml (Bileşenimizin kurulum dosyası)
- install.form.php ve uninstall.form.php (Bileşenimizin kurulum ve kaldırılmasında gerekecek dosyalar)
- form.php (Bileşenimizin çalışması için gereken kodların olduğu dosya)

Bu 4 dosyayı zipleyip yönetim panelinden yüklediğinizde ve daha sonra menüden link verdiğinizde elinizde oldukça basit bir formMail denilen (yani form ile mailimize veri gönderen) bir bileşenimiz olacaktır.

_________________
www.joomlagunleri.org - Joomla Buluşma Noktanız


Top
   
 
Posted: Thu Jan 17, 2008 11:50 am 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Jul 10, 2007 8:48 am
Posts: 183
Paylaşım için teşekkürler.

_________________
http://joomladestek.jo.funpic.de


Top
   
 
Posted: Wed Jan 07, 2009 7:26 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Dec 30, 2008 1:23 pm
Posts: 31
Harika bir paylaşım olmuş, teşekkür ederiz.

_________________
http://www.ozeldireksiyondersim.com/ - Özel Direksiyon Dersi
http://www.foxnets.com/ - Foxnets


Top
  E-mail  
 
Posted: Thu Jan 08, 2009 1:21 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Jan 03, 2009 2:15 am
Posts: 21
Hi - Sorry for my english. Could someone explain what this thread is about? I think it is what I am looking for. I want to edit the frontend form.php to include the Advanced Parameters which are available at the backend. I have included the parameters in form.xml but I need to call them in form.php so that they will save. Do you know how I can call the Advanced Parameters in the frontend? Thanks for your help in advance.


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

Quick reply

 



Who is online

Users browsing this forum: No registered users and 1 guest


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 © 2000, 2002, 2005, 2007 phpBB Group