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 8508731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:14:26+00:00 2026-06-11T03:14:26+00:00

i have a stylesheet link like so <link href=css/<? echo $theme;?>/styles.css rel=stylesheet type=text/css />

  • 0

i have a stylesheet link like so

<link href="css/<? echo $theme;?>/styles.css" rel="stylesheet" type="text/css" />

Inside the CSS I want to be able to echo a background image outputted by the db

body{ background-image:url(../../images/<?php echo $theme.'/'.$background;?>);}

I tried adding the following to the beginning of my page but it just output everything in html code

<? header ("Content-type: text/css");?>

Im sure there is a bit to this, can anyone advise the best course of action?

Thanks in advance

  • 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-11T03:14:28+00:00Added an answer on June 11, 2026 at 3:14 am

    Change the file ending to php so it gets run by the server, and once you’ve done that you can link to it as if it was a regular css file and make sure the header is correct set with that header code you have at the top of the file

    Change:

    <link href="css/<? echo $theme;?>/styles.css" rel="stylesheet" type="text/css" />
    

    To:

    <link href="css/<? echo $theme;?>/styles.php" rel="stylesheet" type="text/css" />
    

    and top of that file you have

    <? header ("Content-type: text/css");?>
    

    And btw since you seem to have php shorttags already enabled you might aswell use instead of using

    <? echo $var;?>
    

    Use

    <?=$var;?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<head> <link rel=stylesheet type=text/css href=mystyle.css> <script src=myscript.js></script> </head> I'd like to have a function
I have the following page: <html> <head> <title>Kahil</title> <link rel=stylesheet type=text/css href=csshorizontalmenu1.css /> </head>
I have stylesheet block in base layout: {% stylesheets filter='cssrewrite' 'bundles/static/css/main.css' %} <link rel=stylesheet
I have a CSS stylesheet defined in the Master Page of my project. On
Lets say I have a xslt stylesheet like the following: <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet
I have the following snippet that overwrites certain CSS properties:- var styleSheet = document.styleSheets[2];
I'd like to have a small browser that uses my own CSS. The problem
I have a stylesheet, application.css defined in layouts/application.html.erb : <%= stylesheet_link_tag application %> However,
I have a page that allows users to dynamically change the loaded theme (stylesheet).
As you all know, it's extremely common to have code like this: <a href='#'

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.