The problem:
I'd like to build – with PHP – a background-image url
on a server (Apache) (url itself or a full directory name).
I'd like to use a portable mechanism, I mean a PHP script
should work in Windows, Unix and Linux. In Windows I use:
...
<style type="text/css">
..a_class
{
<?php
$S_1 = getcwd()."/images/image_1.jpg"; //BACKGROUND PICTURE
echo "background-image: url($S_1);";
?>
....
It works fine but it doesn't work in FreeBSD, for example.
Thank you in advance.
Marek Kotowski
Warsaw 4 1777
Hi Marek,
[...] .. $S_1 = getcwd()."/images/image_1.jpg"; //BACKGROUND PICTURE
It works fine but it doesn't work in FreeBSD, for example.
What version of PHP on you "TEST" System and on FreeBSD ?
Kind Regards ?
--
Dipl.Ing.(FH) Karl Heinz Marbaise | www.marbaise.org
Jabba Dabba Dooh ;-) | ICQ# 135949029 Ma************@ wsip.com.pl (Marek Kotowski) wrote in message
news:<e5******* *************** ****@posting.go ogle.com>... I'd like to build ? with PHP ? a background-image url on a server (Apache) (url itself or a full directory name). I'd like to use a portable mechanism, I mean a PHP script should work in Windows, Unix and Linux. In Windows I use:
.. <style type="text/css">
.a_class { <?php $S_1 = getcwd()."/images/image_1.jpg"; //BACKGROUND PICTURE echo "background-image: url($S_1);"; ?> ...
It works fine
Only when client computer and the server are one and the same...
getcwd() returns the local name of the current working directory,
which is meaningless when client and server run on different
machines.
Here are two possible options for you:
Option One (no PHP involved, URL to the image is relative):
.a_class
{
background-image: '/images/image_1.jpg';
...
}
Option Two (some PHP involved, URL to the image is absolute):
.a_class
{
<?php
echo "background-image: 'http://",
$_SERVER['SERVER_NAME'],
"/images/image_1.jpg';";
?>
...
}
Cheers,
NC nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32******* *************** ****@posting.go ogle.com>...
.... Here are two possible options for you:
Option One (no PHP involved, URL to the image is relative):
.a_class { background-image: '/images/image_1.jpg'; ... }
It doesn't work but I changed it a little to
background-image: url('images/image_1.jpg');
and this version works on Windows and FreeBSD as well.
Thank you very much.
Regards
Marek Kotowski
Warsaw
Karl Heinz Marbaise <kh********@gmx .de> wrote in message news:<c3******* ******@ID-68093.news.uni-berlin.de>... What version of PHP on you "TEST" System and on FreeBSD ?
Windows XP - 4.3.2.
FreeBSD - 4.3.4.
Kind regards. :-)
Marek Kotowski
Warsaw This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Vorbrodt |
last post by:
Hi there. Is this code portable between platforms? Is it also 100% standard
compliant?
#include <iostream>
using namespace std;
class Point {
public:
enum COORDS { X = 0, Y, Z };
Point(int x, int y, int z) : _x(x), _y(y), _z(z) {}
|
by: Marc R. Bertrand |
last post by:
Hello,
Do some of you know some pretty good books or web tutorials on
building databases, if any? By that I mean, when looking at a
business, the sound way of choosing the proper fields and the proper
way to group these fields to construct the tables that make up a
database, while anticipating database growth.
I have learned quite a bit of SQL (thanks to Chris Fehily's Visual
Quickstart Guide SQL) but now I want to find some practical...
|
by: Stephen |
last post by:
I've been working on some code which will hopefully allow me to transfer the
contents of an arraylist on one page over to another page. The Arraylist is
held in the viewstate object as it is populated on the on-click event of a
button. Im trying to move to another page and carry over the items in my
arraylist and write them to the page. The code ive been trying to work with
to achieve is detailed below. I am getting an error and im not...
|
by: John Boy |
last post by:
Hi,
Can anyone help. This is really doing my nut in. 3 years ASP exp. and
now doing .DOT which is a step in the wrong direction.
Basically I am left with the code of a guy who has left. When I click a
button on a pop-up window the javascript for that button click does a
'button.form.submit'. On the Server side there is a Button click event
for this button, but for some reason it no longer fires. It worked fine
before and everything...
|
by: pemo |
last post by:
Is C really portable? And, apologies, but this is possibly a little OT?
In c.l.c we often see 'not portable' comments, but I wonder just how
portable C apps really are.
I don't write portable C code - *not only* because, in a 'C sense', I
| |
by: Lyners |
last post by:
What I need - To retrieve the server name that the ASP application is running
on.
Why - Our current intranet is on a network where we have users that are on a
domain and some that are not. Using I.P. addresses all the users can access
the ASP pages. Using I.P. addresses, no one can use our .net pages because
the header that is passed back from the server has extra security that
require the end users to "log-in" to the server. This is...
|
by: Kristan Dyson |
last post by:
I was just wondering whether you knew whether it is possible to compile a
fully portable C program? I want to write a 'C' CGI program on Windows,
then just upload it to my Plus.Net Debian-based server.
As I want to write pure ANSI C, then I thought it may be possible to write a
program that would run fine on both. Having said that, surely (?), it would
have to be compiled for specific platforms, unless of course there is some
abstraction...
|
by: r.z. |
last post by:
class vector3
{
public:
union
{
float data;
struct
{
float x, y, z;
};
|
by: Brian Gladman |
last post by:
A lot of low level cryptographic code and some hardware cryptographic
accelerators either fail completely or perform very poorly if their input,
output and/or key storage areas in memory are not aligned on specific memory
boundaries. Moreover, in many situations the cryptographic code does not
itself have control over the memory alignment of its parameters so the best
it can do is to detect if these aligmments are correct and act...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |