drupal etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
drupal etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

16 Temmuz 2011 Cumartesi

Cpanel Cron ile bir web safası çalıştırmak

durpal yada diğer içerik yönetim sistemleri cron.php dosyasının belirli periyodlarla çalışmasını istemekte eğer cron job tanımlayabilirseniz(mesela cpanel ile)herhangi bir modül yüklemeye gerek kalmadan cron.php yada başka bir php dosyasını çalıştırabilirsiniz. bunun için cronun çalıştıracağı
komut /usr/bin/wget http://www.tersduz.com/cron.php

cronun çalışacağı zamanıda belirterek artık cronu çalıştırabilirsiniz.

18 Şubat 2011 Cuma

Drupal'da i18n de ve view la ilgili yazmış olduğum kıymetli kod parçam


$view = views_get_current_view();
  // [0] is first arg, [1] is second etc.
$new_var = $view-> args[0];
$lang = i18n_get_lang();

if($lang == 'tr'){
echo "

$new_var
";
}
else{
echo "
$new_var
";
}

session_start();
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$_SESSION['adres'] = $url; // adres
?>

9 Şubat 2011 Çarşamba

Drupal de blockları node gömmek

ilk olarak bir view bloğunu node içine gömen kod;

$block = module_invoke('views', 'block', 'view', 'Urunler-block_1');
?>

Bu işi en iyi yapan ve argumanıyla view bloğuna  gömen kod
$viewName = 'Urunler';
print views_embed_view($viewName, 'default', 'Classic Tente');
?>



Başka bir modülün oluşturduğu block node içinde gösterilecekse;
$block = module_invoke('quicktabs', 'block', 'view', 2);
print $block['content'];
?>
























20 Ocak 2011 Perşembe

drupal welcome screen remover

Welcome to your new Drupal website!

Please follow these steps to set up and start using your website:.....

 ---------------------------------------------------------------------
if you remove drupal welcome screen you can add  your thema  css file 

#first-time { display:none; } 

that is ok!  

12 Ocak 2011 Çarşamba

drupal add prefix sql command

you can use this sql command but if you have different tables so that you must to add or delete here ;

RENAME TABLE
   access TO drupal_access,
   accesslog TO drupal_accesslog,
   actions TO drupal_actions,
   actions_aid TO drupal_actions_aid,
   aggregator_category TO drupal_aggregator_category,
   aggregator_category_feed TO drupal_aggregator_category_feed,
   aggregator_category_item TO drupal_aggregator_category_item,
   aggregator_feed TO drupal_aggregator_feed,
   aggregator_item TO drupal_aggregator_item,
   authmap TO drupal_authmap,
   batch TO drupal_batch ,
   blocks TO drupal_blocks,
   blocks_roles TO drupal_blocks_roles,
   blogapi_files TO drupal_blogapi_files,
   boxes TO drupal_boxes,
   cache TO drupal_cache,
   cache_block TO drupal_cache_block,
   cache_content TO drupal_cache_content,
   cache_filter TO drupal_cache_filter,
   cache_form TO drupal_cache_form,
   cache_menu TO drupal_cache_menu,
   cache_page TO drupal_cache_page,
   cache_update TO drupal_cache_update,
   cache_views TO drupal_cache_views,
   cache_views_data TO drupal_cache_views_data,
   comments TO drupal_comments,
   contact TO drupal_contact,
   content_group TO drupal_content_group,
   content_group_fields TO drupal_content_group_fields,
   content_node_field TO drupal_content_node_field,
   content_node_field_instance TO drupal_content_node_field_instance,
   content_type_resim TO drupal_content_type_resim,
   files TO drupal_files,
   filters TO drupal_filters,
   filter_formats TO drupal_filter_formats,
   flood TO drupal_flood,
   history TO drupal_history,
   imagecache_action TO drupal_imagecache_action,
   imagecache_preset TO drupal_imagecache_preset,
   imce_files TO drupal_imce_files,
   languages TO drupal_languages,
   locales_source TO drupal_locales_source,
   locales_target TO drupal_locales_target,
   menu_custom TO drupal_menu_custom,
   menu_links TO drupal_menu_links,
   menu_router TO drupal_menu_router,
   node TO drupal_node,
   node_access TO drupal_node_access,
   node_comment_statistics TO drupal_node_comment_statistics,
   node_counter TO drupal_node_counter,
   node_revisions TO drupal_node_revisions,
   node_type TO drupal_node_type,
   openid_association TO drupal_openid_association,
   openid_nonce TO drupal_openid_nonce,
   permission TO drupal_permission,
   poll TO drupal_poll,
   poll_choices TO drupal_poll_choices,
   poll_votes TO drupal_poll_votes,
   profile_fields TO drupal_profile_fields,
   profile_values TO drupal_profile_values,
   role TO drupal_role,
   search_dataset TO drupal_search_dataset,
   search_index TO drupal_search_index,
   search_node_links TO drupal_search_node_links,
   search_total TO drupal_search_total,
   semaphore TO drupal_semaphore,
   sessions TO drupal_sessions,
   system TO drupal_system,
   term_data TO drupal_term_data,
   term_hierarchy TO drupal_term_hierarchy,
   term_node TO drupal_term_node,
   term_relation TO drupal_term_relation,
   term_synonym TO drupal_term_synonym,
   upload TO drupal_upload,
   url_alias TO drupal_url_alias,
   users TO drupal_users,
   users_roles TO drupal_users_roles,
   variable TO drupal_variable,
   views_display TO drupal_views_display,
   views_object_cache TO drupal_views_object_cache,
   views_view TO drupal_views_view,
   vocabulary TO drupal_vocabulary,
   vocabulary_node_types TO drupal_vocabulary_node_types,
   watchdog TO drupal_watchdog,
   wysiwyg TO drupal_wysiwyg;

15 Aralık 2010 Çarşamba

Drupal Modül Geliştirme Dersleri

Drupal ile modül geliştirme dersleri için bu bağlantıda dersleri çok beğendim.
makale başlığı; 
Creating modules - a tutorial: Drupal 6.x
adresi;
http://drupal.org/node/206753
paylaşmak istedim.

Drupal API İle Yeni Bir Nodu Kodla Oluşturmak

Drupal modül geliştirirken yada otomatik içerik oluştururken nodu(düğümleri) kodla oluşturmamız gerekebilir.
nodu oluşturan api fonksiyonu.
node_save( $newnode );
fakat buradaki $newnode değişkeni işin önemli yanı.
$newnode değişkeni oluşturmak için şöyle yapabiliriz;Böyle otomatik php ile içerik basmamız mümkün
  1. $newnode = new stdClass();
  2. $newnode->title = 'title';
  3. $newnode->body = 'whatever full html you like';
  4. global $user;
  5. $newnode->uid = $user->uid;
  6. $newnode->name = $user->name;
  7. $newnode->type = 'page';
  8. $newNode->format = 2;     // 1 means filtered html, 2 means full html, 3 is php
  9. $newnode->status = 1;     // 1 means published
  10. $newnode->promote = 0;
  11. $newnode = node_submit( $newnode );
  12. node_save( $newnode );
  13. ?>
     

11 Aralık 2010 Cumartesi

drupal kullanıcı ismine göre işlem yapmak

global $user;
$kisiadi = $user->name;
if($kisiadi == "admin")
{

}
else
{
echo ("2");
}

?>



yukarıdaki kodu kullanarak bir drupal sistemi üzeirnde kullanıcı adını alıp bir işlem gerçekleştirebilmekteyim
referans için http://api.drupal.org/api/drupal/developer--globals.php/global/user/6#comment-7349

23 Kasım 2010 Salı

Drupal Türkçe Dil Dosyası

Drupal Türkçe Dil Dosyasına http://drupal.org/node/233068 adresinden ulaşabilirsiniz.
Drupal varsayılı olarak Türkçe dil dosyaları ile gelmekte fakat oldukca yetersiz bir dil dosyası var.
Drupal Çekirdek  Modüllerinden Locale etkinleştirdek sonra bu adreste bulunan .po uzantılı dosyayı import ederek yeni kelimeleri sözlüğe katabilirsiniz.

5 Kasım 2010 Cuma

Drupal Block Sayfa içinde görülsün Regionda değil

Bilindiği gibi Drupalda bir Block tanımlandığında bunlar region içinde görülebilir.Ama Blogu bir Page(sayfa) içinde görülmesi gibi ilginç bir şey yapabiliriz.
Öncelikle Block'a fare ile değiştir düğmesinin üzerine tıklayarak id sini ve hangi modül ile ilintili olduğunu görmeliyiz.
Örneğin: /admin/build/block/configure/block/26
Gibi bir şey gördüysek php kodumuz şöyle olmalı;Böylece bir sayfa içinde Block gösterebileceğiz


$block = module_invoke('block', 'block', 'view', 26);
print $block['content'];
?>


2 Kasım 2010 Salı

Drupal Contact Formu (İletişim Formu) Mesaj Gönderme Limiti

Drupalda sitenize gelen ziyaretçiler size spam göndermemeleri için bir koruma mekanızsı vardır.Eğer kişiler contack formunu kullarak size 3 den fazla mesaj göndermek gibi bir işlem yaparlarsa karşılarına bu mesaj çıkar "You cannot send more than 3 messages per hour. Please try again later. " 
Bu mesaja göre  bir saat içinde 3 den fazla mesaj gönderemezsiniz diypr.Eğer Misafirlerinizin 3 den fazla mesaj göndermesini isterseniz.

Contact modülü içinde contact.pages.inc dosyasında (genellikle dizini \modules\contact\contact.pages.inc)

dosyasındaki 16. ve 17. satrlardaki
if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) {
    $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));

3 yazılı yerleri istediğiniz rakamla değiştirmek

19 Ekim 2010 Salı

drupal comment width ayarlamak

Bu kadar basit bir işle ancak bu kadar uğraşılır.
Drupaldaki yorum yazılan width uzunluğu öyle yerlerden çekiliyorki koda girmeden html-yada css den düzeltmek imkansız.

system modüllerinin olduğu dizine gidip /modules/comment dizini altındaki
comment.module içine (biliyorum sistem dosyası olduğunu gir abim sen )
1372 satırdaki
$form['comment_filter']['comment'] = array(
    '#type' => 'textarea',
    '#title' => t('Comment'),
    '#rows' => 15,'#cols' => 50
    '#default_value' => $default,
    '#required' => TRUE,
  );


satıra '#cols' => 50 satırını eklemeniz bu değer varsayılı olan  60px değerini değiştirmenizi sağlıyor.
bu değer nerde varsayılı derseniz onada bakalım hemen :)
system.module içinde 

$type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 5, '#resizable' => TRUE, '#process' => array('form_expand_ahah'));
 

18 Ekim 2010 Pazartesi

Show if the following PHP code returns TRUE (PHP-mode, experts only).

Drupal da bir block un nerde görünüp görünmeyeceği genellikle ciddi bir sorundur.
Eğer özel bir block ise ve sadece belli bir content için görünecekse standart drupal ile çözmeniz zor olup birazcık php ile işe girişmek lazım.
Show if the following PHP code returns TRUE (PHP-mode, experts only).

bölümünü seçip
aşağıdaki kıymetli kodu yazmalıyız.
  // Only show if $return is true
  $return = FALSE;

  // Match current node type with story
  if ( (arg(0) == 'node') && is_numeric(arg(1)) )  {
    $nid = arg(1);
    $node = node_load($nid);
    $type = $node->type;
    if($type == "story") {
       $return = TRUE;
    }
    if($nid == "18982"){
       $return = TRUE;
     }
  }
 
  return $return;
  ?>


bu kod ile şöyle demiş oluruz  story isimli  tüm contentlerde ve node id si 18982 olan page de bu blogu göster değilse sakın haaa gösterme.


Not: Bu yazı işine yarayan kişiler en azından yorum eklesinlerki bende bloga sadece kendim için yazmadığımdan emin olayım :)