RE: [Nolug] Dynamic Text

From: Roetto Mike B CONT SSGC <RoettoMB_at_SUPSHIP.NAVY.MIL>
Date: Mon, 8 Mar 2004 13:18:37 -0600
Message-ID: <0918BEB5200DD311ACFE0008C7391B11021A55EE@ssnoexch.ssno.nola.navy.mil>

Here's another way to skin the cat. This is snippet of code that I use to
load headlines into a scrolling banner. This way the users have a simple
text file that isn't as easy to foul up the syntax as a php include file.

The headlines file looks like this
Yahoo Home Page = http://www.yahoo.com
CNN Home Page = http://www.cnn.com

etc,etc.

--snip--

$in = fopen("headlines.txt", "r");
while (!feof($in)) {
            $line = fgets($in, 4096);
        list($desc,$url)= split ("=", $line, 2);

        print "<param name=\"text$r\" value=\"$desc\">";
        print "<param name=\"link$r\" value=\"$url\">";

}

-----Original Message-----
From: Jeff Lee [mailto:jeffreydavidlee@hotmail.com]
Sent: Monday, March 08, 2004 12:52 PM
To: nolug@joeykelly.net
Subject: Re: [Nolug] Dynamic Text

The example you game me seems to be exactly what I am looking to do, and a
lot easier than I expected it to be. I am new to this and would just like to
get a working example to use and learn from, however; I get this error when
I run file.php:

 Parse error: parse error, unexpected T_INCLUDE in
/var/www/html/think/public_html/file.php on line 1

The files are as follows:

file.php-
<? php include ("/www/think/public_html/includes.inc");
<body>
This is a dynamic name: <?php echo "$name" ; ?>
This is a dynamic product: <?php echo "$product" ; ?>
</body>
?>

includes.inc-

<?php
 $name = "Jeff";
 $product = "oranges";
?>

----- Original Message -----
From: <scotth@scottharney.com>
To: <nolug@joeykelly.net>
Sent: Monday, March 08, 2004 12:40 PM
Subject: Re: [Nolug] Dynamic Text

> "Jeff Lee" <jeffreydavidlee@hotmail.com> writes:
>
> > I am trying to make a website using dynamic text components from a file.
I
> > do not know where to start and do not think my server even has this
> > installed. I got XML working but I dont think it can do what I want. I
want
> > something like what is below:
> >
> > <body>
> > This is a dynamic name: %%name%%
> > This is a dynamic product: %%product%%
> > </body>
> >
> > .. some other file
> >
> > %%name%% = Jeff
> > %%product%% = oranges
>
> You need to use the php language, mod_perl, java Server pages, or even
> cgi. Fancy templating systems are available for these languages to do
> the kind of substition you want. Your instance or apache will need to
> have support for these products. It should have cgi by default.
>
> I'm not sure what you mean by "I got XML working" . What you need is
> for your webserver to process dynamic input in some way. all of the
> above items represent a "processing engine" of sorts for dynamic
> content. The page is processed, for example, by a php interpreter
> before being output to the requester as HTML. XSLT is an XML-based
> stylesheet language but it requires something that hooks into the
> webserver to process it. All of the aforementioned languages can do
> that.
>
> php is pretty easy to learn. Here's a mockup of what you're doing
>
> file.php:
> <? php include ("/path/to/includes.inc");
> <body>
> This is a dynamic name: <?php echo "$name" ; ?>
> This is a dynamic product: <?php echo "$product" ; ?>
> </body>
>
> includes.inc:
> <?php
> $name = "Jeff";
> $product = "oranges";
> ?>
>
> php's website has good docs and there are many books available as
> well. www.php.net is the site. Your distro may offer a download
> of it that will work with your copy of apache. perhaps it has
> it now. put a file that looks like this in your web doc root
> called "phptest.php"
> <html>
> <body>
> hello
> <?php
> phpinfo();
> ?>
> </body>
> </html>
>
>
> Point your webbrowser at it. If it's working, you'll see a page full
> of information about your php install.
>
> --
> Scott Harney<scotth@scottharney.com>
> "...and one script to rule them all."
> gpg key fingerprint=7125 0BD3 8EC4 08D7 321D CEE9 F024 7DA6 0BC7 94E5
> ___________________
> Nolug mailing list
> nolug@nolug.org
>
___________________
Nolug mailing list
nolug@nolug.org
___________________
Nolug mailing list
nolug@nolug.org
Received on 03/08/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST