0

I have one page structure. This is my menu:

<ul id="creamenu" class="menuHolder">
    <li><a id="news-1-menu" href="#/news-1">news 1</a></li>
    <li><a id="news-2-menu" href="#/news-2">news 2</a></li>
    <li><a id="news-3-menu" href="#/news-3">news 3</a></li>
</ul>
<ul id="mainmenu" class="menuHolder">
    <li><a id="about1-menu" href="#/hakkimizda">about 1</a></li>
    <li><a id="about2-menu" href="#/haberler">about 2</a></li>
    <li><a id="about3-menu" href="#/galeri">about 3</a></li>
    <li><a id="about4-menu" href="#/referanslar">about 4</a></li>
    <li><a id="about5-menu" href="#/iletisim">about 5</a></li>
</ul>

And this is content structure:

<div id='news-1'>
    <!-- content -->
    <!-- content -->
</div>
<div id='news-2'>
    <!-- content -->
    <!-- content -->
</div>

When I click a menu item goes to content in same page, but my site is slow. I think if I separate all tpl.php files maybe I'll improve my site performance. But I don't know how can I do it.

For example, click news-1 item go to news-1.tpl.php file.

3
  • how are you going to the content are you using any javascript? Commented Jan 22, 2013 at 12:25
  • By the way, your menu links should be #link, not #/link for simple anchors unless your doing something dynamic.
    – Alex Gill
    Commented Jan 22, 2013 at 12:27
  • 1
    Drupal 7 Template (Theme Hook) Suggestions. drupal.org/node/1089656
    – niksmac
    Commented Jan 22, 2013 at 12:34

2 Answers 2

0

Separating your tpl.php files in that manner won't improve your site's performance in the way that you hope, unless your current base node.tpl.php file is doing something really weird right now.

Loading more tpl.php files in a single page generally makes things slower not faster, as more hooks are invoked for preprocessing, etc...

Chances are, that if you have a 1-pager the tpl.php file being processed is not slowing your site down. It will be something in the database layer or excessing php processing, or incorrect caching setup.

If you still really want to do it, try Nikhil M's link to get the template naming suggestions.

0

You could use Drupal Services to get your Content via AJAX calls.

After setting up your service, bind with jQuery a clickhandler to your links and replace your content with your AJAX Response.

If you don't know the Services Module, study it's code and the documentation. Once you know how to do it, it's very easy!

With this solution, you must initial load just one node, this give your site a good Performance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.