FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » can't get includes to load
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
can't get includes to load [message #180920] Tue, 26 March 2013 06:52 Go to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
$ pwd
/home/sites/migrate
$ ls -l
total 168
....
drwxr-xr-x 2 fred automation 4096 Mar 25 23:03 includes
-rw-r--r-- 1 fred automation 2208 Mar 25 23:32 index.html
....
-rw-r--r-- 1 fred automation 896 Mar 25 21:49 style.css
....
drwxr-xr-x 2 fred automation 4096 Mar 25 21:56 variables
$ cd includes/
$ ls -l
total 20
-rw-r--r-- 1 fred automation 88 Mar 25 23:03 footer.php
-rw-r--r-- 1 fred automation 106 Mar 25 23:02 footer.php~
-rw-r--r-- 1 fred automation 99 Mar 25 22:08 header.php
-rw-r--r-- 1 fred automation 0 Mar 25 21:57 header.php~
-rw-r--r-- 1 fred automation 141 Mar 25 22:15 nav.php
-rw-r--r-- 1 fred automation 0 Mar 25 21:59 nav.php~
-rw-r--r-- 1 fred automation 638 Mar 25 22:16 sidebar.php
-rw-r--r-- 1 fred automation 0 Mar 25 22:00 sidebar.php~
$ cd ..
$ cat index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<meta name="description" content="" />

<meta name="keywords" content="" />

<meta name="author" content="" />

<link rel="stylesheet" type="text/css" href="style.css" media="screen" />

<title>Food, Glorius Food</title>

</head>

<body>

<div id="wrapper">

<?php include('includes/header.php'); ?>

<?php include('includes/nav.php'); ?>

<div id="content">

<h1>This is how</h1>
<h2>headlines</h2>
<h3>can get</h3>
<h4>smaller</h4>
<h5>and smaller</h5>

<h3>Food: do we need another site for it?</h3>

<p>

What makes recipes good? a) when they're useful. b) when you can find
them. c) when they're adaptable. In this picture, we see the
california brown rice measured while the water comes to boil. There's a
can of tomatoes and a can of pineapple that came from the Alameda County
food bank. This gives us another criterion: d) when they use up what
you have.


</p>

<p>

When you're getting cans of food from who knows where, you have to wash
the tops before you open them. Food-born sicknesses usually only kill
the infirm, but you talk to people like loni fredricks, that's not a
small thing.

</p>

<h3>I had a pork dish too</h3>

<p>

I spent one dollar on the protein for this to feed 2. This was sweet
and sour pork over rice and a fantastic success. (My) Jenny ate it all
night and has the nutrition she needs to start the week out well.
Pretty standard reduction while I watched march madness.


</p>

<p>

Also, got my tools sorted out. I'm not beating the brush in oakland to
find under the table work. What I think I'm gonna find out is that I
have a renewed incentive to work *over* the table again, and to do that
I am going to promote myself with php, which could do this whole recipe
thing with permissions and comments and all that.


</p>

</div> <!-- end #content -->

<?php include('includes/sidebar.php'); ?>

<?php include('includes/footer.php'); ?>

</div> <!-- End #wrapper -->

</body>

</html>


$

Right now, index.html loads but none of the other and it exits without
complaint. This is only running on my linux machine here at the local
root directory, which is indicated by the pwd command.

Thanks for your comment.
--
Cal
Re: can't get includes to load [message #180921 is a reply to message #180920] Tue, 26 March 2013 08:36 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 26/03/13 07:52, Cal Dershowitz wrote:
> $ pwd
> /home/sites/migrate
> $ ls -l
> total 168
> ...
> drwxr-xr-x 2 fred automation 4096 Mar 25 23:03 includes
> -rw-r--r-- 1 fred automation 2208 Mar 25 23:32 index.html
> ...
> -rw-r--r-- 1 fred automation 896 Mar 25 21:49 style.css
> ...
> drwxr-xr-x 2 fred automation 4096 Mar 25 21:56 variables
> $ cd includes/
> $ ls -l
> total 20
> -rw-r--r-- 1 fred automation 88 Mar 25 23:03 footer.php
> -rw-r--r-- 1 fred automation 106 Mar 25 23:02 footer.php~
> -rw-r--r-- 1 fred automation 99 Mar 25 22:08 header.php
> -rw-r--r-- 1 fred automation 0 Mar 25 21:57 header.php~
> -rw-r--r-- 1 fred automation 141 Mar 25 22:15 nav.php
> -rw-r--r-- 1 fred automation 0 Mar 25 21:59 nav.php~
> -rw-r--r-- 1 fred automation 638 Mar 25 22:16 sidebar.php
> -rw-r--r-- 1 fred automation 0 Mar 25 22:00 sidebar.php~
> $ cd ..
> $ cat index.html
> <?php include('includes/header.php'); ?>
> <?php include('includes/nav.php'); ?>
> <?php include('includes/sidebar.php'); ?>
> <?php include('includes/footer.php'); ?>

From the file layout, it looks correct, we do recommend you use
$_SERVER['DOCUMENT_ROOT'] for includes eg:

include $_SERVER['DOCUMENT_ROOT'].'includes/sidebar.php';

this will make it easier the day when you put things in sub folders,
like /home/sites/migrate/articles and you still want to include those
from /home/sites/migrate/include.


> Right now, index.html loads but none of the other and it exits without
> complaint. This is only running on my linux machine here at the local
> root directory, which is indicated by the pwd command.

You have an index.html, when apache looks at the file it will think of
it as plain html and just output it as it is, you can easily verify this
by looking at the source code in the browser (right click on the page
and select "View Page Source"), you will see those <?php ?> tags.

The fix is to do a:

mv /home/sites/migrate/index.html /home/sites/migrate/index.php

now apache will use the php engine to parse the file and php engine will
replace the <?php ?> with the content in the files.

Sure there are some people who would say to add html to the AddHandler
for php, but please do not listen to them, you will make your apache/php
to work more and you will not be compliant with most hosting companies,
so when you upload your things to your web hotel you want it to work.

--

//Aho
Re: can't get includes to load [message #180931 is a reply to message #180921] Tue, 26 March 2013 21:50 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/26/2013 01:36 AM, J.O. Aho wrote:

[re-ordered, for thematic reasons]

>> Right now, index.html loads but none of the other and it exits without
>> complaint. This is only running on my linux machine here at the local
>> root directory, which is indicated by the pwd command.
>
> You have an index.html, when apache looks at the file it will think of
> it as plain html and just output it as it is, you can easily verify this
> by looking at the source code in the browser (right click on the page
> and select "View Page Source"), you will see those <?php ?> tags.
>
> The fix is to do a:
>
> mv /home/sites/migrate/index.html /home/sites/migrate/index.php
>
> now apache will use the php engine to parse the file and php engine will
> replace the <?php ?> with the content in the files.
>
> Sure there are some people who would say to add html to the AddHandler
> for php, but please do not listen to them, you will make your apache/php
> to work more and you will not be compliant with most hosting companies,
> so when you upload your things to your web hotel you want it to work.
>

Thx JO, that simple thing was it. I now have my first php webpage out
on my domain space as opposed to just the localhost.

http://merrillpjensen.com/index.php#

Why did the server add a hash on the end of it?

Why does the sidebar not end up on the side like it does for the local
host and the same browser?

I uploaded these files using Filezilla. I can see that if this is the
way I'm going to do this, then whatever ends up on my server will be
riddled with mistakes and differing versions of things.

> From the file layout, it looks correct, we do recommend you use
> $_SERVER['DOCUMENT_ROOT'] for includes eg:
>
> include $_SERVER['DOCUMENT_ROOT'].'includes/sidebar.php';
>
> this will make it easier the day when you put things in sub folders,
> like /home/sites/migrate/articles and you still want to include those
> from /home/sites/migrate/include.

And again thx,but I made this change and got a parse error from it. I
can't even show it, because I had to go in and overwrite it so as to
have anything to show at all, which is important so that others can see
what I'm trying to do.

I have simple questions at this point: how do you try something new on
your server without stomping all over the last thing that worked?
--
Cal
Re: can't get includes to load [message #180932 is a reply to message #180931] Wed, 27 March 2013 02:14 Go to previous messageGo to next message
Jim Higgins is currently offline  Jim Higgins
Messages: 20
Registered: November 2010
Karma: 0
Junior Member
On Tue, 26 Mar 2013 14:50:20 -0700, in
<3bednVqnL5qAhc_MnZ2dnUVZ_q6dnZ2d(at)supernews(dot)com>, Cal Dershowitz
<cal(at)example(dot)invalid> wrote:

> Thx JO, that simple thing was it. I now have my first php webpage out
> on my domain space as opposed to just the localhost.
> http://merrillpjensen.com/index.php#
> Why did the server add a hash on the end of it?


It didn't, unless you clicked one of the links in the menu on that
page. Those dummy links consist of nothing but "#".


> Why does the sidebar not end up on the side like it does for the local
> host and the same browser?


Did you also upload the CSS file that controls the layout for this
page?


> I uploaded these files using Filezilla. I can see that if this is the
> way I'm going to do this, then whatever ends up on my server will be
> riddled with mistakes and differing versions of things.


Why? If you have a page on your server and the same page on your
local machine, just copy/backup that page on the local machine, make
your updates to the original, view them, then upload the new page to
the server. When you're satisfied all is well, delete the backup.

And if you maintain the same directory structure on your local machine
as on your server, the pages should work just fine in both places.

What you can't do is (for example) have your CSS files in some
directory on your local machine that has a different name than on your
server. If you do that the reference to the CSS file that works on
the local machine won't find the CSS file on the server.


>> From the file layout, it looks correct, we do recommend you use
>> $_SERVER['DOCUMENT_ROOT'] for includes eg:
>>
>> include $_SERVER['DOCUMENT_ROOT'].'includes/sidebar.php';
>>
>> this will make it easier the day when you put things in sub folders,
>> like /home/sites/migrate/articles and you still want to include those
>> from /home/sites/migrate/include.
>
> And again thx,but I made this change and got a parse error from it.


If you have a parse error you probably have a typo. See that little
dot after ['DOCUMENT_ROOT']? Did you leave it out? Inspect the above
and what you have character by character.


> I have simple questions at this point: how do you try something new on
> your server without stomping all over the last thing that worked?


Let's say the page you want to work on is named ORIGINAL.PHP. You
make a copy of that file and you call it something like
ORIGINAL.PHP.BAK. Then you work on ORIGINAL.PHP. If you need more
copies og that original, you can append a date or a letter or whatever
after BAK to differentiate them.
Re: can't get includes to load [message #180934 is a reply to message #180932] Wed, 27 March 2013 06:53 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 27/03/13 03:14, Jim Higgins wrote:
> On Tue, 26 Mar 2013 14:50:20 -0700, in
> <3bednVqnL5qAhc_MnZ2dnUVZ_q6dnZ2d(at)supernews(dot)com>, Cal Dershowitz

>> I have simple questions at this point: how do you try something new on
>> your server without stomping all over the last thing that worked?
>
>
> Let's say the page you want to work on is named ORIGINAL.PHP. You
> make a copy of that file and you call it something like
> ORIGINAL.PHP.BAK. Then you work on ORIGINAL.PHP. If you need more
> copies og that original, you can append a date or a letter or whatever
> after BAK to differentiate them.

I would say this is a medieval method and sadly I have seen this done by
consults who been working on web sites. I do not recommend this method,
use git or similar to keep track of files and it even allow you fast
switch between branches where you test different things.

http://wiki.freegeek.org/index.php/Git_for_dummies
http://www.ralfebert.de/tutorials/git/

far easier to just do a "git checkout index.php" if you want to revert
to the old version and you do not have to worry that you by mistake
edited a file without making a "BAK/BUP" copy of it.

--

//Aho
cleaning up first php page was Re: can't get includes to load [message #180935 is a reply to message #180932] Wed, 27 March 2013 07:00 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/26/2013 07:14 PM, Jim Higgins wrote:
> On Tue, 26 Mar 2013 14:50:20 -0700, in
> <3bednVqnL5qAhc_MnZ2dnUVZ_q6dnZ2d(at)supernews(dot)com>, Cal Dershowitz
> <cal(at)example(dot)invalid> wrote:
>
>> Thx JO, that simple thing was it. I now have my first php webpage out
>> on my domain space as opposed to just the localhost.
>> http://merrillpjensen.com/index.php#
>> Why did the server add a hash on the end of it?
>
>
> It didn't, unless you clicked one of the links in the menu on that
> page. Those dummy links consist of nothing but "#".

ok
>
>
>> Why does the sidebar not end up on the side like it does for the local
>> host and the same browser?
>
>
> Did you also upload the CSS file that controls the layout for this
> page?


I thought I did, but I didn't. Again I used filezilla, but this time
correctly. Unfortunately, I'm my own weak link in this new endeavor.

Looks better now:

http://merrillpjensen.com/index.php

>
>
>> I uploaded these files using Filezilla. I can see that if this is the
>> way I'm going to do this, then whatever ends up on my server will be
>> riddled with mistakes and differing versions of things.
>
>
> Why? If you have a page on your server and the same page on your
> local machine, just copy/backup that page on the local machine, make
> your updates to the original, view them, then upload the new page to
> the server. When you're satisfied all is well, delete the backup.

Well, for example, my question about why the nav bar was bottoming out
makes no sense now. It's great that you can hide your mistakes like
that, but I doubt that my path to php perfection is going to be so
linear that I won't ever want to double back in significant ways.
>
> And if you maintain the same directory structure on your local machine
> as on your server, the pages should work just fine in both places.
>
> What you can't do is (for example) have your CSS files in some
> directory on your local machine that has a different name than on your
> server. If you do that the reference to the CSS file that works on
> the local machine won't find the CSS file on the server.

Ok, and thanks for your reply, jim, I think I can make the local
directory structure that I want to have mimicked for right now. I think
it's a reasonable goal for this thread to just clean up and personalize
what I have so far.
>
>
>>> From the file layout, it looks correct, we do recommend you use
>>> $_SERVER['DOCUMENT_ROOT'] for includes eg:
>>>
>>> include $_SERVER['DOCUMENT_ROOT'].'includes/sidebar.php';
>>>
>>> this will make it easier the day when you put things in sub folders,
>>> like /home/sites/migrate/articles and you still want to include those
>>> from /home/sites/migrate/include.
>>
>> And again thx,but I made this change and got a parse error from it.
>
>
> If you have a parse error you probably have a typo. See that little
> dot after ['DOCUMENT_ROOT']? Did you leave it out? Inspect the above
> and what you have character by character.

I would bet long odds that I missed a character.
>
>
>> I have simple questions at this point: how do you try something new on
>> your server without stomping all over the last thing that worked?
>
>
> Let's say the page you want to work on is named ORIGINAL.PHP. You
> make a copy of that file and you call it something like
> ORIGINAL.PHP.BAK. Then you work on ORIGINAL.PHP. If you need more
> copies og that original, you can append a date or a letter or whatever
> after BAK to differentiate them.
>

What is a person supposed to do about the fact that if you just type in
www.merrillpjensen.com , you get the old index.html? Should I just
re-direct that to a php version?

Also taking any and all suggestions* on how to make this start looking
like a webpage that you would show a client.
--
Cal

*except from jerry struekle, who is not invited on my threads, because I
need signal, not noise.
Re: cleaning up first php page was Re: can't get includes to load [message #180936 is a reply to message #180935] Wed, 27 March 2013 08:06 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 27/03/13 08:00, Cal Dershowitz wrote:
> On 03/26/2013 07:14 PM, Jim Higgins wrote:
>> Let's say the page you want to work on is named ORIGINAL.PHP. You
>> make a copy of that file and you call it something like
>> ORIGINAL.PHP.BAK. Then you work on ORIGINAL.PHP. If you need more
>> copies og that original, you can append a date or a letter or whatever
>> after BAK to differentiate them.

Just a reminder, use git instead of making backup files.


> What is a person supposed to do about the fact that if you just type in
> www.merrillpjensen.com , you get the old index.html? Should I just
> re-direct that to a php version?

Delete the index.html and problem solved.

Another case, as you seem to give out a link with index.* it can be good
to use the apache rewrite module to redirect those who try to access the
index.html file directly, in your .htaccess you could have something
like this:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ /index.php [L]

Haven't tested it, so in worst case you need to make some tiny changes.


> Also taking any and all suggestions* on how to make this start looking
> like a webpage that you would show a client.

You maybe want to look at a CMS and just make a theme for it and then
add on your own plugins to do things you want it to do and no one else
has already done, then you don't have to reinvent the wheel.


--

//Aho
Re: can't get includes to load [message #180937 is a reply to message #180932] Wed, 27 March 2013 08:08 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Jim Higgins wrote:

> Cal Dershowitz wrote:
>> I have simple questions at this point: how do you try something new on
>> your server without stomping all over the last thing that worked?
>
> Let's say the page you want to work on is named ORIGINAL.PHP. You
> make a copy of that file and you call it something like
> ORIGINAL.PHP.BAK. Then you work on ORIGINAL.PHP. If you need more
> copies og that original, you can append a date or a letter or whatever
> after BAK to differentiate them.

Or you are a *responsible* *professional* Web developer.

Then you would use a local (private) Web server with a sufficiently similar
setup on which you test changes before you upload to the remote (public)
one. You would not upload files directly, but commit to a project
repository of a version control system (like SVN or git) allowing you to
roll back the remote version to a working state at any time should it turn
out that – then unlikely – something did not work remotely that did work
locally.

You would keep your commits atomic (changes that belong together go into the
same commit) and write commit comments so you would know what you changed
and where you changed it (and, if you are in a team, who made the change),
removing the need for a host of almost-duplicate files on the server that
only you know about (and have to reverse-engineer with manual diff what you
changed and why you changed it back then; and, if you are in a team, who
changed it).


HTH

PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom(at)94(dot)75(dot)214(dot)39>
Re: can't get includes to load [message #180938 is a reply to message #180934] Wed, 27 March 2013 09:35 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/26/2013 11:53 PM, J.O. Aho wrote:
> On 27/03/13 03:14, Jim Higgins wrote:
>> On Tue, 26 Mar 2013 14:50:20 -0700, in
>> <3bednVqnL5qAhc_MnZ2dnUVZ_q6dnZ2d(at)supernews(dot)com>, Cal Dershowitz
>
>>> I have simple questions at this point: how do you try something new on
>>> your server without stomping all over the last thing that worked?
>>
>>
>> Let's say the page you want to work on is named ORIGINAL.PHP. You
>> make a copy of that file and you call it something like
>> ORIGINAL.PHP.BAK. Then you work on ORIGINAL.PHP. If you need more
>> copies og that original, you can append a date or a letter or whatever
>> after BAK to differentiate them.
>
> I would say this is a medieval method and sadly I have seen this done by
> consults who been working on web sites. I do not recommend this method,
> use git or similar to keep track of files and it even allow you fast
> switch between branches where you test different things.
>
> http://wiki.freegeek.org/index.php/Git_for_dummies
> http://www.ralfebert.de/tutorials/git/
>
> far easier to just do a "git checkout index.php" if you want to revert
> to the old version and you do not have to worry that you by mistake
> edited a file without making a "BAK/BUP" copy of it.
>

JO,

This is very impressive software.

http://www.ralfebert.de/blog/tools/git_screencast/

http://en.wikipedia.org/wiki/GitHub

$ sudo apt-get install git
[sudo] password for fred:
....
$ git --version
git version 1.7.9.5

Good enough for me to want to try it. Now ... where to install. I've
been developing my web capabilities through a mix of perl and bash
scripts. These have lain in a "parent" directory which heretofore has
been called 'migrate'. As the the name suggests, it's been moving
around to find a home. Subdirectories were projects that resulted in
web pages which I have used for my various and sundry purposes:

$ pwd
/home/sites/migrate
$ ls
a.html index.php nikon_bash1.sh~ reg1.pl
bash3.sh index.php~ nikon_bash2.sh reg1.pl~
bash3.sh~ melancholia nikon_bash2.sh~ reg2.pl
cleaning mel_ftp2.pl nikon_bash3.sh reg2.pl~
cp_1.pl micah nikon_bash3.sh~ reg2.pl.bak
dog migrate_ftp1.pl nikon_bash4.sh sos
food migrate_ftp1.pl~ nikon_bash4.sh~ style.css
food_1.html music nra style.css~
fredify2.sh music1.pl php Untitled Document 1
fredify2.sh~ music1.pl~ php1.sh variables
includes music2.pl phpini.sh
index.html~ nikon_bash1.sh phpini.sh~

Beyond being the directory that localhost looks to as root, it's gotten
pretty junked up, in the sense that there's a lot in there that
shouldn't get loaded to the remote server. There are scripts to take
images from my camera and resize them in a child directory, such as this
new one:

$ cd php
$ ls -l
total 12
drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 php1
drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 php2
drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 template
$ cd php1
$ ls -l
total 12
drwxr-xr-x 2 fred automation 4096 Mar 27 00:13 includes
-rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
-rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
$

In php1, I have a copy of what exists on my remote server now. php2
was a copy I made of it just to start tapping away at. I was thinking
that php would be the place where I would want to run the init command.

Sound ok so far?
--
Cal
Re: can't get includes to load [message #180939 is a reply to message #180938] Wed, 27 March 2013 10:00 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 27/03/13 10:35, Cal Dershowitz wrote:

> Good enough for me to want to try it. Now ... where to install. I've
> been developing my web capabilities through a mix of perl and bash
> scripts. These have lain in a "parent" directory which heretofore has
> been called 'migrate'. As the the name suggests, it's been moving
> around to find a home. Subdirectories were projects that resulted in
> web pages which I have used for my various and sundry purposes:

first of all, I would remove all the files ending with ~

find /home/sites/migrate -name "*~" -exec rm -f {} \;

just copy paste that one, if you feel insure, then make a backup of the
directory:

cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip migrate.tar

(I know, you can simplify that)

Keep in mind, both are "one liners" and just copy past from this post.

> $ pwd
> /home/sites/migrate
> $ ls
> a.html index.php nikon_bash1.sh~ reg1.pl
> bash3.sh index.php~ nikon_bash2.sh reg1.pl~
> bash3.sh~ melancholia nikon_bash2.sh~ reg2.pl
> cleaning mel_ftp2.pl nikon_bash3.sh reg2.pl~
> cp_1.pl micah nikon_bash3.sh~ reg2.pl.bak
> dog migrate_ftp1.pl nikon_bash4.sh sos
> food migrate_ftp1.pl~ nikon_bash4.sh~ style.css
> food_1.html music nra style.css~
> fredify2.sh music1.pl php Untitled Document 1
> fredify2.sh~ music1.pl~ php1.sh variables
> includes music2.pl phpini.sh
> index.html~ nikon_bash1.sh phpini.sh~
>
> Beyond being the directory that localhost looks to as root, it's gotten
> pretty junked up, in the sense that there's a lot in there that
> shouldn't get loaded to the remote server. There are scripts to take
> images from my camera and resize them in a child directory, such as this
> new one:

I would clean up things a bit, have your handy scripts in a directory
outside and give it a better name than php, so you remember what you
have there.

When you have structured up things a bit, so you find you stuff easily,
just make a git repository for it all

cd /home/sites && git init && git commit -m "initial commit" -a

now you will have everything in the git repository and you are ready to
work. You have your tarball if you by mistake did delete a file you
shouldn't have.

> $ cd php
> $ ls -l
> total 12
> drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 php1
> drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 php2
> drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 template
> $ cd php1
> $ ls -l
> total 12
> drwxr-xr-x 2 fred automation 4096 Mar 27 00:13 includes
> -rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
> -rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
> $
>
> In php1, I have a copy of what exists on my remote server now. php2 was
> a copy I made of it just to start tapping away at. I was thinking that
> php would be the place where I would want to run the init command.

I would ditch the php2, no use of it, all work you do should origin from
what you have live. Don't forget to create a new branch when you start
to work with something, when you put something live, you merge that
branch to master branch. So master should always be what you have in
live, other branches are for what you are working on or testing.

--

//Aho
Re: can't get includes to load [message #180940 is a reply to message #180939] Wed, 27 March 2013 10:03 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 27/03/13 11:00, J.O. Aho wrote:
> On 27/03/13 10:35, Cal Dershowitz wrote:
>
>> Good enough for me to want to try it. Now ... where to install. I've
>> been developing my web capabilities through a mix of perl and bash
>> scripts. These have lain in a "parent" directory which heretofore has
>> been called 'migrate'. As the the name suggests, it's been moving
>> around to find a home. Subdirectories were projects that resulted in
>> web pages which I have used for my various and sundry purposes:
>
> first of all, I would remove all the files ending with ~
>
> find /home/sites/migrate -name "*~" -exec rm -f {} \;
>
> just copy paste that one, if you feel insure, then make a backup of the
> directory:
>
> cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip migrate.tar
>
> (I know, you can simplify that)
>
> Keep in mind, both are "one liners" and just copy past from this post.
>
>> $ pwd
>> /home/sites/migrate
>> $ ls
>> a.html index.php nikon_bash1.sh~ reg1.pl
>> bash3.sh index.php~ nikon_bash2.sh reg1.pl~
>> bash3.sh~ melancholia nikon_bash2.sh~ reg2.pl
>> cleaning mel_ftp2.pl nikon_bash3.sh reg2.pl~
>> cp_1.pl micah nikon_bash3.sh~ reg2.pl.bak
>> dog migrate_ftp1.pl nikon_bash4.sh sos
>> food migrate_ftp1.pl~ nikon_bash4.sh~ style.css
>> food_1.html music nra style.css~
>> fredify2.sh music1.pl php Untitled Document 1
>> fredify2.sh~ music1.pl~ php1.sh variables
>> includes music2.pl phpini.sh
>> index.html~ nikon_bash1.sh phpini.sh~
>>
>> Beyond being the directory that localhost looks to as root, it's gotten
>> pretty junked up, in the sense that there's a lot in there that
>> shouldn't get loaded to the remote server. There are scripts to take
>> images from my camera and resize them in a child directory, such as this
>> new one:
>
> I would clean up things a bit, have your handy scripts in a directory
> outside and give it a better name than php, so you remember what you
> have there.
>
> When you have structured up things a bit, so you find you stuff easily,
> just make a git repository for it all
>
> cd /home/sites && git init && git commit -m "initial commit" -a
>
> now you will have everything in the git repository and you are ready to
> work. You have your tarball if you by mistake did delete a file you
> shouldn't have.
>
>> $ cd php
>> $ ls -l
>> total 12
>> drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 php1
>> drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 php2
>> drwxr-xr-x 3 fred automation 4096 Mar 26 17:14 template
>> $ cd php1
>> $ ls -l
>> total 12
>> drwxr-xr-x 2 fred automation 4096 Mar 27 00:13 includes
>> -rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
>> -rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
>> $
>>
>> In php1, I have a copy of what exists on my remote server now. php2 was
>> a copy I made of it just to start tapping away at. I was thinking that
>> php would be the place where I would want to run the init command.
>
> I would ditch the php2, no use of it, all work you do should origin from
> what you have live. Don't forget to create a new branch when you start
> to work with something, when you put something live, you merge that
> branch to master branch. So master should always be what you have in
> live, other branches are for what you are working on or testing.

Should have told you, if you want to make things a bit easier, you can
use a repository tool from atlassian, cost 10USD, but will be worth it,
stash makes it easier to merge things.

http://www.atlassian.com/software/stash/overview

--

//Aho
Re: can't get includes to load [message #180941 is a reply to message #180939] Thu, 28 March 2013 07:17 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/27/2013 03:00 AM, J.O. Aho wrote:

> first of all, I would remove all the files ending with ~
>
> find /home/sites/migrate -name "*~" -exec rm -f {} \;
>
> just copy paste that one, if you feel insure, then make a backup of the
> directory:
>
> cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip migrate.tar
>
> (I know, you can simplify that)
>
> Keep in mind, both are "one liners" and just copy past from this post.

Alright, good things, JO, the commands seemed to work just fine. What's
more, you wrote these commands at a level where I have the vaguest
notion of how they work, which is also important. I keep logs of such
useful techniques in an ad hoc way.
> I would clean up things a bit, have your handy scripts in a directory
> outside and give it a better name than php, so you remember what you
> have there.
>
> When you have structured up things a bit, so you find you stuff easily,
> just make a git repository for it all
>
> cd /home/sites && git init && git commit -m "initial commit" -a
>
> now you will have everything in the git repository and you are ready to
> work. You have your tarball if you by mistake did delete a file you
> shouldn't have.

$ cd /home/sites && git init && git commit -m "initial commit" -a
Initialized empty Git repository in /home/sites/.git/
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .jonathan.txt.swp
# j2.txt
# jonathan.txt
# migrate/
# www.nmlutherhaven.com/
# www.sttimschurch.net/
nothing added to commit but untracked files present (use "git add" to track)

Now did it take a snapshot all the way up the directory tree?

The directories there with url-sounding names were the results of wget
commands. I don't need them anymore. How would I go about deleting
them and them bringing them back to life with git just for practice?
> I would ditch the php2, no use of it, all work you do should origin from
> what you have live. Don't forget to create a new branch when you start
> to work with something, when you put something live, you merge that
> branch to master branch. So master should always be what you have in
> live, other branches are for what you are working on or testing.
>

I understand somewhat and simply need to practice. Thanks for your
very-useful comments.
--
Cal
Git (Was: can't get includes to load) [message #180942 is a reply to message #180941] Thu, 28 March 2013 07:35 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 28/03/13 08:17, Cal Dershowitz wrote:
> On 03/27/2013 03:00 AM, J.O. Aho wrote:
>
>> first of all, I would remove all the files ending with ~
>>
>> find /home/sites/migrate -name "*~" -exec rm -f {} \;
>>
>> just copy paste that one, if you feel insure, then make a backup of the
>> directory:
>>
>> cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip
>> migrate.tar
>>
>> (I know, you can simplify that)
>>
>> Keep in mind, both are "one liners" and just copy past from this post.
>
> Alright, good things, JO, the commands seemed to work just fine. What's
> more, you wrote these commands at a level where I have the vaguest
> notion of how they work, which is also important.

The first one uses find to find files, in this case the files ending
with a tilde and then delete those, the {} is the file name and the \;
is just telling we are at the end of the command we wanted to run on all
the found files. Keep in mind to always have the "" around the file name
you are looking for, or bash will expand it and you will get false results.


> $ cd /home/sites && git init && git commit -m "initial commit" -a
> Initialized empty Git repository in /home/sites/.git/
> # On branch master
> #
> # Initial commit
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # .jonathan.txt.swp
> # j2.txt
> # jonathan.txt
> # migrate/
> # www.nmlutherhaven.com/
> # www.sttimschurch.net/
> nothing added to commit but untracked files present (use "git add" to
> track)

Sorry, the -a option don't work with uncommited files, it to work the
files has to be in the repository already.

> Now did it take a snapshot all the way up the directory tree?

No, there is nothing in the git repository at the moment.

> The directories there with url-sounding names were the results of wget
> commands. I don't need them anymore. How would I go about deleting
> them and them bringing them back to life with git just for practice?

As your commit failed, you need to first add files

git add migrate j2.txt jonathan.txt && git commit -m "initial commit" -a

and now you would have the migrate and the two text files in the repository.

There is two ways to remove something from the repository, method one:

1. Delete/Rename/Move the file you want to remove
2. git rm <file>
3. git commit -m "why you remove it" <file>

or shorter (this will delete the file for you):

1. git rm <file>
2. git commit -m "why you remove it" <file>

<file> = file or directory
Re: can't get includes to load [message #180943 is a reply to message #180941] Thu, 28 March 2013 07:41 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/28/2013 12:17 AM, Cal Dershowitz wrote:
> On 03/27/2013 03:00 AM, J.O. Aho wrote:

snip
> Now did it take a snapshot all the way up the directory tree?
>
> The directories there with url-sounding names were the results of wget
> commands. I don't need them anymore. How would I go about deleting
> them and them bringing them back to life with git just for practice?
>> I would ditch the php2, no use of it, all work you do should origin from
>> what you have live. Don't forget to create a new branch when you start
>> to work with something, when you put something live, you merge that
>> branch to master branch. So master should always be what you have in
>> live, other branches are for what you are working on or testing.
>>
>
> I understand somewhat and simply need to practice. Thanks for your
> very-useful comments.

I tried to do what falf did in the tutorial, but I seem not to get at
all what files git is working on. Where does the resulting "git-file"
end up?

$ pwd
/home/sites/migrate/php/php1
$ ls
includes index.php readme.txt readme.txt~ style.css
$ git add readme.txt
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: readme.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# ../../../.jonathan.txt.swp
# ../../../j2.txt
# ../../../jonathan.txt
# ../../bash3.sh
# ../../cleaning/
# ../../cp_1.pl
# ../../dog/
# ../../food/
# ../../fredify2.sh
# ../../git1.txt
# ../../git1.txt~
# ../../includes/
# ../../index.php
# ../../melancholia/
# ../../micah/
# ../../migrate_ftp1.pl
# ../../music1.pl
# ../../music2.pl
# ../../nikon_bash1.sh
# ../../nikon_bash2.sh
# ../../nikon_bash3.sh
# ../../nikon_bash4.sh
# includes/
# index.php
# readme.txt~
# style.css
# ../../php1.sh
# ../../phpini.sh
# ../../reg1.pl
# ../../reg2.pl
# ../../reg2.pl.bak
# ../../sos/
# ../../style.css
# ../../variables/
# ../../../www.nmlutherhaven.com/
# ../../../www.sttimschurch.net/
$

So what now? Since this
/home/sites/migrate/php/php1
is the directory I *really* want to have this capability in, should I
do the git init there?

I do want to keep the php directory in this because of the way I process
images. I want to have a vacant parent directory, where I put all the
images and then store them in some subdirectory.
--
Cal
Git (Was: can't get includes to load) [message #180944 is a reply to message #180943] Thu, 28 March 2013 08:34 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 28/03/13 08:41, Cal Dershowitz wrote:
> On 03/28/2013 12:17 AM, Cal Dershowitz wrote:
>> On 03/27/2013 03:00 AM, J.O. Aho wrote:

<renamed topic as it's now more of git than anything else and really off
topic to for this news group>

> snip
>> Now did it take a snapshot all the way up the directory tree?
>>
>> The directories there with url-sounding names were the results of wget
>> commands. I don't need them anymore. How would I go about deleting
>> them and them bringing them back to life with git just for practice?
>>> I would ditch the php2, no use of it, all work you do should origin from
>>> what you have live. Don't forget to create a new branch when you start
>>> to work with something, when you put something live, you merge that
>>> branch to master branch. So master should always be what you have in
>>> live, other branches are for what you are working on or testing.
>>>
>>
>> I understand somewhat and simply need to practice. Thanks for your
>> very-useful comments.
>
> I tried to do what falf did in the tutorial, but I seem not to get at
> all what files git is working on. Where does the resulting "git-file"
> end up?

after you run "git init" there will be a .git directory in the directory
where you did the "git init" in.

Everything about the repository is stored there. If you want to remove
the git repository once and for all, then just delete the directory
(keep in mind you loose all the history and will end up with the files
which you have checked out).


> $ pwd
> /home/sites/migrate/php/php1
> $ ls
> includes index.php readme.txt readme.txt~ style.css
> $ git add readme.txt
> $ git status
> # On branch master
> #
> # Initial commit
> #
> # Changes to be committed:
> # (use "git rm --cached <file>..." to unstage)
> #
> # new file: readme.txt
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # ../../../.jonathan.txt.swp
> # ../../../j2.txt
> # ../../../jonathan.txt
> # ../../bash3.sh
> # ../../cleaning/
> # ../../cp_1.pl
> # ../../dog/
> # ../../food/
> # ../../fredify2.sh
> # ../../git1.txt
> # ../../git1.txt~
> # ../../includes/
> # ../../index.php
> # ../../melancholia/
> # ../../micah/
> # ../../migrate_ftp1.pl
> # ../../music1.pl
> # ../../music2.pl
> # ../../nikon_bash1.sh
> # ../../nikon_bash2.sh
> # ../../nikon_bash3.sh
> # ../../nikon_bash4.sh
> # includes/
> # index.php
> # readme.txt~
> # style.css
> # ../../php1.sh
> # ../../phpini.sh
> # ../../reg1.pl
> # ../../reg2.pl
> # ../../reg2.pl.bak
> # ../../sos/
> # ../../style.css
> # ../../variables/
> # ../../../www.nmlutherhaven.com/
> # ../../../www.sttimschurch.net/
> $
>
> So what now? Since this
> /home/sites/migrate/php/php1
> is the directory I *really* want to have this capability in, should I do
> the git init there?

You shouldn't have a git inside a git. Remove the /home/sites/.git first
and then create a new git in the directory /home/sites/migrate/php/php1

rm -rf /home/sites/.git
cd /home/sites/migrate/php/php1
git init
git add .
git commit -m "Initial commit for php1 which has a quite bad name"

Now you would have the git for only the php1 directory. I do opt you to
have better naming for your directories and files.


> I do want to keep the php directory in this because of the way I process
> images. I want to have a vacant parent directory, where I put all the
> images and then store them in some subdirectory.

git allows you to version handle images too, if you want, it's not
limited to source files, of course a diff between two version of an
image will not give you anything of value, just the possibility to
revert to the old image.


--

//Aho
Re: Git (Was: can't get includes to load) [message #180961 is a reply to message #180944] Fri, 29 March 2013 07:28 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/28/2013 01:34 AM, J.O. Aho wrote:
> On 28/03/13 08:41, Cal Dershowitz wrote:

> after you run "git init" there will be a .git directory in the directory
> where you did the "git init" in.

I don't see it, and I just ran it.
> Don't have a git inside a git. Remove the /home/sites/.git first
> and then create a new git in the directory /home/sites/migrate/php/php1
>
> rm -rf /home/sites/.git
> cd /home/sites/migrate/php/php1
> git init
> git add .
> git commit -m "Initial commit for php1 which has a quite bad name"
>
> Now you would have the git for only the php1 directory. I do opt you to
> have better naming for your directories and files.
>
>
>> I do want to keep the php directory in this because of the way I process
>> images. I want to have a vacant parent directory, where I put all the
>> images and then store them in some subdirectory.
>
> git allows you to version handle images too, if you want, it's not
> limited to source files, of course a diff between two version of an
> image will not give you anything of value, just the possibility to
> revert to the old image.
>
>

I try to understand, but since I don't see a .git file in root,
apparently I don't.
$ pwd
/home/sites/migrate/php/php1
$ ls -l
total 24
-rw-r--r-- 1 fred automation 1480 Mar 29 00:06 git1.txt
-rw-r--r-- 1 fred automation 1400 Mar 29 00:02 git1.txt~
drwxr-xr-x 2 fred automation 4096 Mar 27 23:44 includes
-rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
-rw-r--r-- 1 fred automation 4 Mar 28 00:23 readme.txt
-rw-r--r-- 1 fred automation 0 Mar 28 00:23 readme.txt~
-rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
$ git init && git commit -m "initial commit"
Initialized empty Git repository in /home/sites/migrate/php/php1/.git/
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# git1.txt
# git1.txt~
# includes/
# index.php
# readme.txt
# readme.txt~
# style.css
nothing added to commit but untracked files present (use "git add" to track)
$ ls -l
total 24
-rw-r--r-- 1 fred automation 1947 Mar 29 00:08 git1.txt
-rw-r--r-- 1 fred automation 1902 Mar 29 00:07 git1.txt~
drwxr-xr-x 2 fred automation 4096 Mar 27 23:44 includes
-rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
-rw-r--r-- 1 fred automation 4 Mar 28 00:23 readme.txt
-rw-r--r-- 1 fred automation 0 Mar 28 00:23 readme.txt~
-rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
$ pwd
/home/sites/migrate/php/php1
$ cat git1.txt
$ find /home/sites/migrate -name "*~" -exec rm -f {} \;
$ cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip
migrate.tar
^C
$ cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip
migrate.tar
^C
$ cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip
migrate.tar
$ ls
Desktop examples.desktop Music Public Videos
Documents Firefox_wallpaper.png perl5 Templates
Downloads migrate.tar.gz Pictures Ubuntu One
$ pwd
/home/fred
$

$ cd /home/sites && git init && git commit -m "initial commit" -a
Initialized empty Git repository in /home/sites/.git/
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .jonathan.txt.swp
# j2.txt
# jonathan.txt
# migrate/
# www.nmlutherhaven.com/
# www.sttimschurch.net/
nothing added to commit but untracked files present (use "git add" to track)

I need to start this where I can make my tool chain work. Right now that's:

$ pwd
/home/sites/migrate/php/php1
$

The previous git has been deleted. I start again. While I do this
great thing I would like to comment on how the word 'git' is a very
different for people who grew up in the Ohio valley. We regard it as a
verb, usually rendered in the imperative to a stupid tracker. Like when
you actually have to go to Lexington KY and have to speak to the natives.

$ cd /home/sites/migrate/php/php1 && git init && git commit -m "initial
commit"

$ ls -l
total 24
-rw-r--r-- 1 fred automation 1480 Mar 29 00:06 git1.txt
-rw-r--r-- 1 fred automation 1400 Mar 29 00:02 git1.txt~
drwxr-xr-x 2 fred automation 4096 Mar 27 23:44 includes
-rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
-rw-r--r-- 1 fred automation 4 Mar 28 00:23 readme.txt
-rw-r--r-- 1 fred automation 0 Mar 28 00:23 readme.txt~
-rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
$

git init && git commit -m "initial commit"

$

I know I'm a little OT here, but everyone who knows me knows that I will
tack right back through this topic, because I said I would, and I meant it.

March madness is a time for hoops holiness.
--
Cal
Re: Git (Was: can't get includes to load) [message #180963 is a reply to message #180961] Fri, 29 March 2013 12:14 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 29/03/13 08:28, Cal Dershowitz wrote:
> On 03/28/2013 01:34 AM, J.O. Aho wrote:
>> On 28/03/13 08:41, Cal Dershowitz wrote:
>
>> after you run "git init" there will be a .git directory in the directory
>> where you did the "git init" in.
>
> I don't see it, and I just ran it.
> I try to understand, but since I don't see a .git file in root,
> apparently I don't.
> $ pwd
> /home/sites/migrate/php/php1
> $ ls -l


"ls -l" will not show it, as it's a hidden directory, you need to use
"ls -la", where the "a" is all.

> $ git init && git commit -m "initial commit"
> Initialized empty Git repository in /home/sites/migrate/php/php1/.git/
> # On branch master
> #
> # Initial commit
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # git1.txt
> # git1.txt~
> # includes/
> # index.php
> # readme.txt
> # readme.txt~
> # style.css
> nothing added to commit but untracked files present (use "git add" to
> track)

This shows you created the git repository, before you can commit
something, you need to add the files you want to track.

git add index.php includes readme.txt style.css

and then you can make the commit.

Remember I told earlier in this thread that the 'git commit -m
"something" -a' only works on files you already are tracking of, in an
empty git repository you ain't tracking anything, those you need to add
files with "git add".


Please read this page:
http://refcardz.dzone.com/refcardz/getting-started-git

If you want more in depth video:
http://excess.org/article/2008/07/ogre-git-tutorial

--

//Aho
Re: Git (Was: can't get includes to load) [message #180989 is a reply to message #180963] Sun, 31 March 2013 07:31 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/29/2013 05:14 AM, J.O. Aho wrote:

>
> "ls -l" will not show it, as it's a hidden directory, you need to use
> "ls -la", where the "a" is all.
>

Geez, thx JO, I think I'm in the clear on this now. This was a tough
thread for me in that the -a meant completely different things as a
modifcation to git as opposed to ls. I do kep my "learning experiences
journaled, tho. They show up as git1.txt. That's not a file that needs
to be committed to git because it's me pasting my litany of
mistakes/learning to it, and it isn't in any way executable.
> This shows you created the git repository, before you can commit
> something, you need to add the files you want to track.
>
> git add index.php includes readme.txt style.css
>
> and then you can make the commit.
>
> Remember I told earlier in this thread that the 'git commit -m
> "something" -a' only works on files you already are tracking of, in an
> empty git repository you ain't tracking anything, those you need to add
> files with "git add".
>
>
> Please read this page:
> http://refcardz.dzone.com/refcardz/getting-started-git
>
> If you want more in depth video:
> http://excess.org/article/2008/07/ogre-git-tutorial
>
$ ls -la
total 36
drwxr-xr-x 4 fred automation 4096 Mar 29 00:09 .
drwxr-xr-x 3 fred automation 4096 Mar 28 00:18 ..
drwxr-xr-x 7 fred automation 4096 Mar 29 00:09 .git
-rw-r--r-- 1 fred automation 1947 Mar 29 00:08 git1.txt
-rw-r--r-- 1 fred automation 1902 Mar 29 00:07 git1.txt~
drwxr-xr-x 2 fred automation 4096 Mar 27 23:44 includes
-rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
-rw-r--r-- 1 fred automation 4 Mar 28 00:23 readme.txt
-rw-r--r-- 1 fred automation 0 Mar 28 00:23 readme.txt~
-rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
$ git add index.php
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: index.php
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# git1.txt
# git1.txt~
# includes/
# readme.txt
# readme.txt~
# style.css
$ git add includes
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: includes/footer.php
# new file: includes/header.php
# new file: includes/nav.php
# new file: includes/sidebar.php
# new file: index.php
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# git1.txt
# git1.txt~
# readme.txt
# readme.txt~
# style.css
$

Outstanding! so boom, all the files in includes are "gotten." I'm not
sure whether Torvalds intended a double-entendre with "git," but for
Amis it's a verb, rendered in the imperative, which also seems apropos.

To my thinking, this is all I need to have backed-up in this grandiose
project so far, so now I'd like to get back to design considerations.

Do I really want to have only one .css file for the whole site?
--
Cal
Re: Git (Was: can't get includes to load) [message #180990 is a reply to message #180989] Sun, 31 March 2013 09:54 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 31/03/13 09:31, Cal Dershowitz wrote:
> On 03/29/2013 05:14 AM, J.O. Aho wrote:
>
>>
>> "ls -l" will not show it, as it's a hidden directory, you need to use
>> "ls -la", where the "a" is all.
>>
>
> Geez, thx JO, I think I'm in the clear on this now. This was a tough
> thread for me in that the -a meant completely different things as a
> modifcation to git as opposed to ls. I do kep my "learning experiences
> journaled, tho. They show up as git1.txt. That's not a file that needs
> to be committed to git because it's me pasting my litany of
> mistakes/learning to it, and it isn't in any way executable.
>> This shows you created the git repository, before you can commit
>> something, you need to add the files you want to track.
>>
>> git add index.php includes readme.txt style.css
>>
>> and then you can make the commit.
>>
>> Remember I told earlier in this thread that the 'git commit -m
>> "something" -a' only works on files you already are tracking of, in an
>> empty git repository you ain't tracking anything, those you need to add
>> files with "git add".
>>
>>
>> Please read this page:
>> http://refcardz.dzone.com/refcardz/getting-started-git
>>
>> If you want more in depth video:
>> http://excess.org/article/2008/07/ogre-git-tutorial
>>
> $ ls -la
> total 36
> drwxr-xr-x 4 fred automation 4096 Mar 29 00:09 .
> drwxr-xr-x 3 fred automation 4096 Mar 28 00:18 ..
> drwxr-xr-x 7 fred automation 4096 Mar 29 00:09 .git
> -rw-r--r-- 1 fred automation 1947 Mar 29 00:08 git1.txt
> -rw-r--r-- 1 fred automation 1902 Mar 29 00:07 git1.txt~
> drwxr-xr-x 2 fred automation 4096 Mar 27 23:44 includes
> -rw-r--r-- 1 fred automation 2208 Mar 26 14:36 index.php
> -rw-r--r-- 1 fred automation 4 Mar 28 00:23 readme.txt
> -rw-r--r-- 1 fred automation 0 Mar 28 00:23 readme.txt~
> -rwxr-xr-x 1 fred automation 896 Mar 25 21:49 style.css
> $ git add index.php
> $ git status
> # On branch master
> #
> # Initial commit
> #
> # Changes to be committed:
> # (use "git rm --cached <file>..." to unstage)
> #
> # new file: index.php
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # git1.txt
> # git1.txt~
> # includes/
> # readme.txt
> # readme.txt~
> # style.css
> $ git add includes
> $ git status
> # On branch master
> #
> # Initial commit
> #
> # Changes to be committed:
> # (use "git rm --cached <file>..." to unstage)
> #
> # new file: includes/footer.php
> # new file: includes/header.php
> # new file: includes/nav.php
> # new file: includes/sidebar.php
> # new file: index.php
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # git1.txt
> # git1.txt~
> # readme.txt
> # readme.txt~
> # style.css
> $
>
> Outstanding! so boom, all the files in includes are "gotten."

They are tracked, they are not stored in the repository, to store them
in the repository you need to make a commit, for example:

git commit -m "initial commit of website design" -a

when you done that, a copy will be stored of the files and if you make
changes to the files and you want to restore it for the changes was no
good, then you can checkout them again.

As long as they are just added, you don't have that feature.


> Do I really want to have only one .css file for the whole site?

The more files you divide things up in (from the point of view of the
web browser), the slower the page will be, try to have everything that
you use in all your pages in one single css and if you have styles which
you use only a few times in a rarely used page, then you can split those
out.

I do recommend you install firebug and yslow and you will get good
information how to improve the speed of your web page.

--

//Aho
Re: cleaning up first php page was Re: can't get includes to load [message #180996 is a reply to message #180936] Thu, 04 April 2013 08:48 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 03/27/2013 01:06 AM, J.O. Aho wrote:
> On 27/03/13 08:00, Cal Dershowitz wrote:

>> What is a person supposed to do about the fact that if you just type in
>> www.merrillpjensen.com , you get the old index.html? Should I just
>> re-direct that to a php version?
>
> Delete the index.html and problem solved.

Alright, well it takes me a couple weeks to catch up on the reading with
this stuff, but I now have a php-written page that has some measure of
functionality to it:

http://www.merrillpjensen.com/

I think task one might be populating the dummy links, and they work, so
woo-hoo.

With the nav links, they have to be populated such that their relative
addresses are gonna work and herewith my next design head-scratcher.

Q1) Am I correct to think that for my stage of the ballgame, I want to
have a unique .css file to which all pages refer?

For ease of upload with Filezilla, I'd like to put it in the includes
directory, which is a ways off from where I'd like to find it with my
'about' page:

$ pwd
/home/sites/migrate/php/php1/includes
$ ls
footer.php header.php nav.php sidebar.php style.css
footer.php~ header.php~ nav.php~ sidebar.php~
$ cd ..
$ echo root document directory
root document directory
$ cd pages/
$ cd about/
$ cat index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

....

<link rel="stylesheet" type="text/css" href="style.css" media="screen" />

What I thought I could get away with was the preliminary hack of copying
and pasting style.css into that folder, but it's just not gonna work
until I get the relative-addressing figured out.

Q2) How do I refer to a "first cousin once removed" file that is 2 up
and one down in includes/ ?

Q3) For lack of a better idea, I used the headers of my original
index.php page for the one that will be in pages/about/ . How do I
write this small, derivative page without requiring the browser to re-do
everything it did to load the home page?

For example, nothing is to change about headers, footers, nav, sidebar
during this invocation.

>
> Another case, as you seem to give out a link with index.* it can be good
> to use the apache rewrite module to redirect those who try to access the
> index.html file directly, in your .htaccess you could have something
> like this:
>
> RewriteEngine On
> RewriteBase /
> RewriteRule ^index\.php$ /index.php [L]
>
> Haven't tested it, so in worst case you need to make some tiny changes.

I wonder whether there's an analog between what you do with default and
what you do with default-ssl:

$ pwd
/etc/apache2/sites-available
$ ls
default default~ default-ssl
$ cat default-ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

Notice the similarities with default. I haven't been able to wrap my
head around ssl yet in this environment but don't want to get farther
away from the php of it.
>
>
>> Also taking any and all suggestions* on how to make this start looking
>> like a webpage that you would show a client.
>
> You maybe want to look at a CMS and just make a theme for it and then
> add on your own plugins to do things you want it to do and no one else
> has already done, then you don't have to reinvent the wheel.
>
>

CMS? plug-ins? Things I know only if different contexts.

Thx for your comment,
--
Cal
Re: cleaning up first php page was Re: can't get includes to load [message #180997 is a reply to message #180996] Thu, 04 April 2013 08:52 Go to previous messageGo to next message
Cal Dershowitz is currently offline  Cal Dershowitz
Messages: 36
Registered: February 2013
Karma: 0
Member
On 04/04/2013 01:48 AM, Cal Dershowitz wrote:
til I get the relative-addressing figured out.
>
> Q2) How do I refer to a "first cousin once removed" file that is 2 up
> and one down in includes/ ?
>

Missed that analogy, it's an uncle/aunt file:

http://www.merrillpjensen.com/pages/about/
--
Cal
Re: cleaning up first php page was Re: can't get includes to load [message #180999 is a reply to message #180996] Thu, 04 April 2013 12:57 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/4/2013 4:48 AM, Cal Dershowitz wrote:
> On 03/27/2013 01:06 AM, J.O. Aho wrote:
>> On 27/03/13 08:00, Cal Dershowitz wrote:
>
>>> What is a person supposed to do about the fact that if you just type in
>>> www.merrillpjensen.com , you get the old index.html? Should I just
>>> re-direct that to a php version?
>>
>> Delete the index.html and problem solved.
>
> Alright, well it takes me a couple weeks to catch up on the reading with
> this stuff, but I now have a php-written page that has some measure of
> functionality to it:
>
> http://www.merrillpjensen.com/
>
> I think task one might be populating the dummy links, and they work, so
> woo-hoo.
>
> With the nav links, they have to be populated such that their relative
> addresses are gonna work and herewith my next design head-scratcher.
>
> Q1) Am I correct to think that for my stage of the ballgame, I want to
> have a unique .css file to which all pages refer?
>

It depends on your site's needs. However, this has nothing to do with PHP.

> For ease of upload with Filezilla, I'd like to put it in the includes
> directory, which is a ways off from where I'd like to find it with my
> 'about' page:
>
> $ pwd
> /home/sites/migrate/php/php1/includes
> $ ls
> footer.php header.php nav.php sidebar.php style.css
> footer.php~ header.php~ nav.php~ sidebar.php~
> $ cd ..
> $ echo root document directory
> root document directory
> $ cd pages/
> $ cd about/
> $ cat index.php
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> ...
>
> <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
>
> What I thought I could get away with was the preliminary hack of copying
> and pasting style.css into that folder, but it's just not gonna work
> until I get the relative-addressing figured out.
>

Again, completely unrelated to PHP.

> Q2) How do I refer to a "first cousin once removed" file that is 2 up
> and one down in includes/ ?
>

Still unrelated to PHP.

> Q3) For lack of a better idea, I used the headers of my original
> index.php page for the one that will be in pages/about/ . How do I
> write this small, derivative page without requiring the browser to re-do
> everything it did to load the home page?
>
> For example, nothing is to change about headers, footers, nav, sidebar
> during this invocation.
>

Your PHP question is?

>>
>> Another case, as you seem to give out a link with index.* it can be good
>> to use the apache rewrite module to redirect those who try to access the
>> index.html file directly, in your .htaccess you could have something
>> like this:
>>
>> RewriteEngine On
>> RewriteBase /
>> RewriteRule ^index\.php$ /index.php [L]
>>
>> Haven't tested it, so in worst case you need to make some tiny changes.
>
> I wonder whether there's an analog between what you do with default and
> what you do with default-ssl:
>
> $ pwd
> /etc/apache2/sites-available
> $ ls
> default default~ default-ssl
> $ cat default-ssl
> <IfModule mod_ssl.c>
> <VirtualHost _default_:443>
> ServerAdmin webmaster@localhost
>
> DocumentRoot /var/www
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> </Directory>
> <Directory /var/www/>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> allow from all
> </Directory>
>
> Notice the similarities with default. I haven't been able to wrap my
> head around ssl yet in this environment but don't want to get farther
> away from the php of it.

Then you might want to get back to PHP. This isn't it.

>>
>>
>>> Also taking any and all suggestions* on how to make this start looking
>>> like a webpage that you would show a client.
>>
>> You maybe want to look at a CMS and just make a theme for it and then
>> add on your own plugins to do things you want it to do and no one else
>> has already done, then you don't have to reinvent the wheel.
>>
>>
>
> CMS? plug-ins? Things I know only if different contexts.
>
> Thx for your comment,

http://www.lmgtfy.com/?q=cms

The Wikipedia article is quite interesting.

If you want to design websites, I would suggest you get some basic books
on HTML, Apache and PHP. They will help you immensely.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: mysql dynamic binding and pass-by-ref deprecated
Next Topic: Java conferences in India...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 10:17:22 GMT 2024

Total time taken to generate the page: 1.33519 seconds