Jump to content

lcot

Members
  • Posts

    8
  • Joined

  • Last visited

lcot's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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..
  2. Okay, how could I implement 'functions' to encapsulate? What is the php process I should do some reading on?
  3. I have a page on a website I am building, that has a row of 4 div blocks that each link to the page they grab information from. So in context, I have 4 div blocks with a Country name, country img, country desk limited to 100 characters and a 'read more' button.. All the information of this div is taken from a country_name.php file. BUT, I have 4 different blocks for each different country. So each country has its own country_name.php file with the same variables, just different values. My questions is, is there a way to include each of the 4 php files so I can include the variables on my page to echo the information, but as the variable names for each country are the same, will I have to start and stop the php include. After the stop point, no more variables from that php file will be outputted. If this is the solution, how?! I have no idea how to do this or the best way to approach this problem? Can anyone help me out here? Thank you!
  4. Thanks ginerjm! I'll do that now!
  5. Thanks for the response!! Yes, you are spot on with what you have just said. That is exactly what I want to happen. I just don't have the experience to understand how to get the two pages to talk to each other. So, my news article link will be the variable that is set in the article php file. And the receiving page, which is the article page template will know which php file to grab it's variables from. I have a folder full of articles. So how is best to go about this?
  6. To get it out of the way, I am learning php as I go and I am new to it. I am really trying to get my hands dirty in it on this project to learn and to make my life easier! I have a scenario, and I would love for someone to help me out through it and point me in the right direction. My scenario is: I have a latest news page on my 'static' website. I am using php includes on the header, navbar and footer for every page. I am using includes to grab the latest news information I have in assets/news/form/news1.php. This is the following: <?php if (!defined("ACCESS")) { die ("Don't waste your time trying to access this file!! Please head to the families relief home page and donate!!"); } ?> <?php $header = 'Article Header'; $date = 'June 1st 2013'; $url = '/news/articleName'; $body = 'Body in HTML'; ?> I then have another file in assets/news/news1.php containing: <div id="appeal3" class="row-fluid"> <div class="well span12"> <div class="span3"> <div class="thumbnail"> <a href="<?php echo $url ?>"><img src="/img/news-blank.jpg"></a> </div> </div><!-- span3 --> <div class="span9 appeals"> <p class="app-date"><?php echo $date?></p> <a href="<?php echo $url ?>"><h3><?php echo $header ?></h3></a> <p><?php echo substr($body, 0, 200) ?><span class="readmore"><a href="<?php echo $url ?> "> ...Read More ></a></span></p> </div><!-- span9 --> </div><!-- well span12 --> </div><!-- appeal# --> I then use the following code on my news overview page at /news/index.php to display the html with the variables entered: <?php include("$_SERVER[DOCUMENT_ROOT]/assets/news/news1.php"); ?> So what this gives me is an overview page, with the news article displayed around a wrapper in overview view. I then have another page when the overview 'read more' is clicked. Within this page, I have a full view news article page with a wrapper where I can echo the variables in. Wha La! That is my news article structure.. Long winded isn't it! Now, what I want!! I want to be able to include the variables from an article into my overview page and include the 2nd block of code above as the template. I then want the articles to fill out the variables. However, I have 5 articles on this page with identical variables. What is the best and most efficient way to do this?? Secondly, I have a full-view article page. How can I use this page as a template, and change the php it gets it's variables from. But, I don't want to create a new php page every time I have a new article. What I had in mind, is something like the following: domain.com/news/article/index.php?news1 I have been reading up on passing variables in a URL. I want to expand my knowledge on this. Could this be the solution to my problem. My issue is that I have NO idea how to go about this? Can someone please lecture me to solve this and hopefully teach me a little in between! Thanks!
  7. 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?
  8. 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.
×
×
  • 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.