Jump to content

PHP - News article page info grab from template?


lcot

Recommended Posts

Hello, Could someone help me out? I would like to simplify my life by providing a news page where I can simply have a template php doc with a blank content area that is filled by data from my news article. Rather than making a new page for every article I publish, I would like to be able to click a link that fills in the data from another php file with the article in.

 

By this I mean so the domain is something like this:

 

> domain.com/news.php?article1

 

rather

 

> than /news/article1.php

 

How can I go about this or where shall I go to read up about something like this. I was thinking of heading to a cms, however taking the time to learn to template my website just for one news page to regularly update seems a little too much effort than it's worth. 

 

I would rather not have to create a new page every time I add an article. I would simply just like to add a new template php file, that I can call upon to display the relevant information on a common news page.

 

My problem is, I am learning at this moment and I do not know where to start.

 

Any advice will be more than welcome! Thank you.

Link to comment
Share on other sites

I am not using SQL as I have no cms and no forms to input into a database. I am trying to make this website usable for other users less experienced than me, but without using a cms like joomla. Only 2 parts of the website want to have variable content.

Would you recommend I use SQL and if so, how shall I go about it?

Link to comment
Share on other sites

ok - you have a site available to you, but no sql database to use.  Hmmm.

 

You could easily create a script that browses a folder containing your articles - text files I presume, or pdfs perhaps.  This script can then build a small paragraph of text, say the first 100 chars, from each article/file.  The script finishes by creating an html page containing all those paragraphs in a grid perhaps and displays it.

 

Now the user clicks on a "read more..." button and your script then builds a different page with all the text of that specific article in one textarea/div/paragraph or whatever.  At the bottom you have a return button that takes you back to the previous page.

 

Sound doable?

Link to comment
Share on other sites

This does sound doable yes. I do however have a news article page template I would like to use and to simply fill in the variables from whichever news article php file it has been clicked from. All the variables are common so don't change between articles. I believe a GET function may be useful here but I am not entirely sure how to implement this..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.