我将按相反的顺序处理您的观点:
标准
我相信标准的接受方法(至少在使用基于 zen 的主题时)是创建一个特定的模板。您实际上不需要添加任何额外的主题功能来使其工作,就好像您将其命名为page-front.tpl.php
将专门用于首页一样。这当然仅适用于您确实需要单独的模板(请参阅 Jeremy 对此的回答)。
所需处理
I don't think there is a perceivable difference intimately connected with the nature of the two different methods. Everything else being the same, it's still a matter for the computer to open a file (the template) and process the PHP in it, whether this is the same file or another one. Solution #1 has an if
statement more but... does it really make a difference?
SPEED
If you are really in bad need for optimisation, I read (if I am not wrong on Pro Drupal Development) that theming a page via a template is 5x times slower than doing it via a function, so you might consider that solution too, although this would only bring a benefit if the homepage is not cacheable, I believe.
HTH!