Skip to Content

"Content Templates" küçük bir soru.

sdemir, Pzt, 22/03/2010 - 19:31 tarihinde.

Arkadaşlar aşağıdaki açıklama modülden alıntıdır.

Disk-based templates

It is also possible to create disk-based template files. To do this, copy the contents of a contemplate textarea and paste it into a file called "node-nodetype-field.tpl.php" where nodetype is the content type and field is either "body", "teaser", or "rss". It is also possible to create a template called "node-nodetype.tpl.php" which will affect all cases, and "node.tpl.php" which will affect all node types.

Buradaki açıklamaya göre node-story.tpl.php dosyası oluşturup story ile ilgili içeriklerle oynayabiliyoruz. Yalnız node-story-body.tpl.php veya node-story-teaser.tpl.php oluşturduğumuzda detaya inemiyoruz. node-story.tpl.php içeriğinde;

<?php
  if ($teaser) print "Teaser içeriği";
  else print "Diğer içerik";
?>

şeklinde küçük bir kod kullanarak sorun çözüldü, yalnız content templates'in örnek gösterdiği şekilde bir yol ile neden sonuca ulaşamıyoruz ?

sdemir, Sal, 23/03/2010 - 11:07 tarihinde.

sites/all/contemplates/node-story-teaser.tpl.php
sites/all/contemplates/node-story-body.tpl.php
sites/all/contemplates/node-story-rss.tpl.php

şeklinde uygulayınca çalışıyor. Tabii düşündüğüm şey, contemplates eklentisinden değişkenleri görerek; ama contemplates kullanmayarak siteyi maksimum hızda çalıştırmaktı. node-story.tpl.php dosyasını contemplates'e bağlı kalmadan kendi temamız içerisine atıp, içeriğini

<?php
  if (!$page) include "falanca_dosya.php";
  else include "filanca_dosya.php";
?>

şeklinde kullanmaya devam edeceğim gibi görünüyor.