Go Back   Christian Guitar Forum > Hobbies & Entertainment > Technology
Register FAQ Members List Calendar Arcade Mark Forums Read

Reply
LinkBack Thread Tools Display Modes
Unread 05-16-2015, 05:32 AM   #16
Be happy
 
bobthecockroach's Avatar
 

Joined: Apr 2001
Location: Louisiana
Posts: 20,571
I applaud your creativity, but there is a much better way.

Typically a blog engine would work by saving content in a database like PostgreSQL. If you don't have that available or don't want to mess with a database (and I don't blame you, databases are a whole other field to learn), the next best thing would be to store the content in plain text files and then pull it in when the php file is executed.

The php file will generate HTML as output, so that's where you do your dynamic content. I will post an example when I'm not on my phone.

__________________
Lord, have mercy
bobthecockroach is offline   Reply With Quote
Sponsored Links
Unread 05-16-2015, 05:33 AM   #17
Be happy
 
bobthecockroach's Avatar
 

Joined: Apr 2001
Location: Louisiana
Posts: 20,571
Oh yes, it would be helpful to know who your host is.
__________________
Lord, have mercy
bobthecockroach is offline   Reply With Quote
Unread 05-16-2015, 09:37 AM   #18
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Quote:
Originally Posted by bobthecockroach
I applaud your creativity, but there is a much better way.

Typically a blog engine would work by saving content in a database like PostgreSQL. If you don't have that available or don't want to mess with a database (and I don't blame you, databases are a whole other field to learn), the next best thing would be to store the content in plain text files and then pull it in when the php file is executed.

The php file will generate HTML as output, so that's where you do your dynamic content. I will post an example when I'm not on my phone.
Thank you!
Quote:
Originally Posted by bobthecockroach
Oh yes, it would be helpful to know who your host is.
FreeServers. I have mixed feelings about them.

Sent using CGR Forum
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 05-18-2015, 07:55 PM   #19
Be happy
 
bobthecockroach's Avatar
 

Joined: Apr 2001
Location: Louisiana
Posts: 20,571
Ok, I haven't had a chance to make an example yet, but I will tomorrow night!
__________________
Lord, have mercy
bobthecockroach is offline   Reply With Quote
Unread 05-19-2015, 07:23 AM   #20
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Quote:
Originally Posted by bobthecockroach View Post
Ok, I haven't had a chance to make an example yet, but I will tomorrow night!
Thanks dude.
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 05-19-2015, 12:53 PM   #21
Be happy
 
bobthecockroach's Avatar
 

Joined: Apr 2001
Location: Louisiana
Posts: 20,571
Do you know what version of PHP FreeServers provides?
__________________
Lord, have mercy
bobthecockroach is offline   Reply With Quote
Unread 05-19-2015, 06:30 PM   #22
Be happy
 
bobthecockroach's Avatar
 

Joined: Apr 2001
Location: Louisiana
Posts: 20,571
This is a greatly, greatly simplified example, but it should provide the basic idea using text files for storage.

Please keep in mind that I have not written any PHP in years, so don't take my coding style as idiomatic for PHP. I'm just trying to show the basic idea of storing content separately from your php/html files and dynamically rendering it when needed.

https://gist.github.com/dbstraight/9acd848d661ac2a4f81f
__________________
Lord, have mercy
bobthecockroach is offline   Reply With Quote
Unread 05-20-2015, 08:22 AM   #23
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Quote:
Originally Posted by bobthecockroach View Post
Do you know what version of PHP FreeServers provides?
I'm assuming the most recent one available. They have entirely Linux-based systems so I'm guessing they do regular updates for such services.
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 03-10-2016, 03:01 PM   #24
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Bump!

I've picked this project up again and this time it's purely PHP and MySQL.

ENGINE MISFIRE:
I can't get the script to log into the database in the first place

The new-and-improved posting page is here.

It sends the data to another PHP file which is supposed to send everything to the database, and it also creates another PHP file that lives at the post's permalink. Each time that file is loaded, it will grab the post's information from the database and regenerate it. The blog's homepage (nonexistent as of yet) will have a counter for the last specified number of posts to display.

If you'd like to see the code I have to review it, ask and you shall receive.

Cheers!
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 03-10-2016, 09:22 PM   #25
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Engine Upgrade:
It logs in now (typo in the username...silly me) and sends posts to the database!

Go ahead and post one! I'll work on permalink pages and the main blog page tomorrow.
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 03-11-2016, 04:25 AM   #26
Be happy
 
bobthecockroach's Avatar
 

Joined: Apr 2001
Location: Louisiana
Posts: 20,571
Good stuff. I'd be happy to review code for you if you like.
__________________
Lord, have mercy
bobthecockroach is offline   Reply With Quote
Unread 03-11-2016, 10:42 PM   #27
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Quote:
Originally Posted by bobthecockroach View Post
Good stuff. I'd be happy to review code for you if you like.
Offer accepted

I got the basic structure for getting the posts into their permalink pages and getting the main blog page to work (that's here by the way) but I was busy/tired today so it wasn't very thorough.
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 03-24-2016, 09:35 PM   #28
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
ENGINE UPGRADE:
The main blog page works now.

You can make comments on posts!

ENGINE MISFIRE:
The permalink pages still don't work.

I'm having trouble with JavaScript to get a hidden div with the comments inside it to display when I hit a button.
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Unread 03-25-2016, 10:53 AM   #29
Official CGR Jedi Master
 
Laguna Master's Avatar
 

Joined: Sep 2013
Location: In a galaxy far, far away...
Posts: 1,093
Misfire:
Only one comment per post shows up. The rest don't display show up in the page's code.

The comment div's Javascript is still being stubborn.
__________________
The Saga of the Laguna

Quote:
Originally Posted by Giuseppe View Post
This is Giuseppes daily reminder to CPFers that you are super awesome and God has a plan for you

*high five*
Quote:
Originally Posted by Leboman View Post
The frequency with which I use the phrase "blows my mind" is directly proportional to the amount of time I spend seriously reading the Bible.
Laguna Master is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 03:10 PM.


Search Engine Friendly URLs by vBSEO 3.6.0 PL2