{"action":"created","issue":{"url":"https://api.github.com/repos/smarty-php/smarty/issues/67","labels_url":"https://api.github.com/repos/smarty-php/smarty/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/smarty-php/smarty/issues/67/comments","events_url":"https://api.github.com/repos/smarty-php/smarty/issues/67/events","html_url":"https://github.com/smarty-php/smarty/issues/67","id":92920000,"number":67,"title":"\"extends\"'s inheritance chain of templates with the same name","user":{"login":"chilek","id":1457437,"avatar_url":"https://avatars.githubusercontent.com/u/1457437?v=3","gravatar_id":"","url":"https://api.github.com/users/chilek","html_url":"https://github.com/chilek","followers_url":"https://api.github.com/users/chilek/followers","following_url":"https://api.github.com/users/chilek/following{/other_user}","gists_url":"https://api.github.com/users/chilek/gists{/gist_id}","starred_url":"https://api.github.com/users/chilek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chilek/subscriptions","organizations_url":"https://api.github.com/users/chilek/orgs","repos_url":"https://api.github.com/users/chilek/repos","events_url":"https://api.github.com/users/chilek/events{/privacy}","received_events_url":"https://api.github.com/users/chilek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-07-03T18:31:29Z","updated_at":"2015-07-09T15:09:43Z","closed_at":"2015-07-03T19:51:10Z","body":"Hello,\r\n\r\nI assume the following scenario:\r\nI have many template directories, when each contains template.html file. Let's assume these directories have names: directory1, directory2, directory3.\r\nThen we add all these directories using Smarty::addTemplateDir() method in exact above order to template directories list.\r\nI'd like to be able to create templates as below:\r\n1) template.html from directory3:\r\n{block name=\"contents\"}This is {/block}\r\n2) template.html from directory2:\r\n{extends file=\"template.html\"}\r\n{block name=\"contents\"}{$smarty.block.parent}the {/block}\r\n3) template.html from directory1:\r\n{extends file=\"template.html\"}\r\n{block name=\"contents\"}{$smarty.block.parent}test.{/block}\r\n\r\nI'd like to get as the result the following text:\r\nThis is the test.\r\n\r\nNow Smarty triggers error in such scenario, because of recursive template loading.\r\nIt could detect that a given directory has been used as template directory for template.html file already and continue searching for template.html file from next template directory in directory chain. It would allow to create dynamically modified templates with simple usage from php code:\r\n$smarty->display('template.html');\r\nThis code could be used by something like application plugins.\r\n\r\nMaybe you have another solution for described scenario?\r\n\r\nBests, Tomasz\r\n"},"comment":{"url":"https://api.github.com/repos/smarty-php/smarty/issues/comments/120022584","html_url":"https://github.com/smarty-php/smarty/issues/67#issuecomment-120022584","issue_url":"https://api.github.com/repos/smarty-php/smarty/issues/67","id":120022584,"user":{"login":"chilek","id":1457437,"avatar_url":"https://avatars.githubusercontent.com/u/1457437?v=3","gravatar_id":"","url":"https://api.github.com/users/chilek","html_url":"https://github.com/chilek","followers_url":"https://api.github.com/users/chilek/followers","following_url":"https://api.github.com/users/chilek/following{/other_user}","gists_url":"https://api.github.com/users/chilek/gists{/gist_id}","starred_url":"https://api.github.com/users/chilek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chilek/subscriptions","organizations_url":"https://api.github.com/users/chilek/orgs","repos_url":"https://api.github.com/users/chilek/repos","events_url":"https://api.github.com/users/chilek/events{/privacy}","received_events_url":"https://api.github.com/users/chilek/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T15:09:43Z","updated_at":"2015-07-09T15:09:43Z","body":"Is there any way to automatically prepend all included files in template with 'extendsall:'?\r\nDoing it for Smarty::display() and Smarty::fetch() is as easy as own fetch() implementation in child class of Smarty, but what about:\r\n```smarty\r\n {include file=\"template.html\"}\r\n```\r\nin parent template? Now I have to put 'extendsall:' before template file name to avoid recursive template loading and it's not convenient :("}}