Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8152665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:46:48+00:00 2026-06-06T15:46:48+00:00

I wanted to append css stylesheet inside head tag but gets appended to body

  • 0

I wanted to append css stylesheet inside head tag but gets appended to body tag.
Here’s what i did:
i have a controller ‘countries’ with action ‘index’ and my view is index.phtml

index.phtml contains:

<?php
 $this->headLink()->appendStylesheet($this->baseUrl().'/js/dojo-1.7/dojo/resources/dojo.css')
             ->appendStylesheet($this->baseUrl().'/js/dojo-1.7/dojox/grid/resources/claroGrid.css');
 echo $this->headLink();

This causes the stylesheet to be appended inside body tag.
I only want these stylesheet to be appended to this action. I dont want to include this stylesheet inside my layout.phtml
How can i do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:46:51+00:00Added an answer on June 6, 2026 at 3:46 pm

    What you’ve done is correct, but you’re echoing headLink() in your view just after adding the stylesheet which is what is outputting the links in the wrong place. Change your code so you have:

    In index.phtml:

    $this->headLink()->appendStylesheet($this->baseUrl().'/js/dojo-1.7/dojo/resources/dojo.css')
             ->appendStylesheet($this->baseUrl().'/js/dojo-1.7/dojox/grid/resources/claroGrid.css');
    

    And then in layout.phtml (in the <head> section where you want the stylesheet links to appear):

    echo $this->headLink();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to append a new line to the end of a file, but
Let's say I have a situation like so: $(window).load(function() { $(body).append(<div id='container'></div>); var i=1;
I wanted to use 6 different textures on a cube, one per side, but
I'm trying to append some data to a file, but in some cases want
I wrote a small program using a custom indexOf function but wanted to dismiss
I have this products catalog site.For the sake of SEO, I would have wanted
I have successfully created an email that sends on creation of a Kase, but
I wanted to run a certain function as a thread, but I get SyntaxError:
What I wanted to have is to collect all the results in an ArrayList
I periodically append logcat info to a file on my SD card, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.