Search the Community
Showing results for tags 'newest'.
-
Hi Folks! New to php and introduced into it by a new found friend who is really into php. Been learning and learning and learning but not so much I am afraid. I guess books and youtubes and other tutorials are not enough so here I am, fearlessly venturing into this forum and I hope to learn much more to all ya pros out there err I mean in here. Be gentle to me please. I am not a coder but I do have logical thinking attitude and habit. I am a slow learner and close to the resignation age. But who cares, I wanna learn php, yeah!
-
Hi again PhpFreakz, yet again I have some issues with my PHP part of my website. A brief summary, I've created an simple CMS for my website so that I am able to add news and results faster and easier. The CMS works great I just have some issues with the finalizing part, so that it also works and looks good with my website. I have in total 3 issues, I will be stating the easiest first and follow up to the hardest. As I'm sure that many people can help me with some of them and might not be able to solve the difficult ones. If you head to this page, you can see my articles I've added to my website. I have an issue with the maximum allowed articles on this page. If I were to add several more articles it would just ignore my design and keep on going. I would like to set a maximum of 4 shown articles, how can i do that? Next up is another fairly easy one. I have - on same page as previous issue - an issue with the articles position. Currently the newest article created is on the bottom, I would like to diverse that so that the top has the newest news and it then goes down to the oldest. My third issue is a fairly complex one (At least for me) and is also an issue on several other pages. If you notice when you click on one of the news in the article page you get redirected to a new page where you can read the full article, problem is that I would like this "new page" to be opened in the same page as where the articles are. For example if you were to change on the navigation, then you get redirected on the same page but only on the "box" that appears. I would like the same effect from when my readers click on one of my articles, they just get a box with the full article and a "go back button". How could i possibly do this? Here are the codes I think are necessary to fix my issues. Let me know if you need anything else and I'll gladly add those. For 1st and 2nd issue: HTML + Some PHP part of index.php <?php foreach ($articles as $article) { ?> <h1 class="newsh1"><a href="article.php?id=<?php echo $article['Id'] ?>"><?php echo $article['title'] ?></a></h1> <p class="newstext"> <?php echo $article[ 'short'] ?> </p> <p class="newsby">Artikel skrevet af <a class="newsauthor" href="#!/page_More"> <?php echo $article[ 'author'] ?> </a>| <span class="newsdate"><?php echo date('j. F o', $article['date']); ?></span> </p> <div class="table"></div> <?php } ?> For 3rd issue: Full code of article.php <?php include_once( 'includes/connection.php'); include_once( 'includes/articles.php'); $article=new Article; if (isset($_GET['id'])) { $id = $_GET['id']; $data = $article->fetch_data($id); ?> <html> <head> <title>CMS System</title> <link rel="stylesheet" href="css/cms.css" /> </head> <body> <div class="container"> <h3><?php echo $data['title'] ?></h3> <small class="margin-left:20px;">Skrevet af <?php echo $data['author'] ?> den <?php echo date('j. F o', $data['date']); ?></small> <p> <?php echo $data[ 'body'] ?> </p> <a href="index.php">← Back</a> </div> </body> </html> <?php } else { header('Location: index.php'); exit(); } ?> HTML+PHP part on index.php <li id="Nyheder"> <div class="box1"> <div class="inner"> <a href="#" class="close" data-type="close"><span></span></a> <div class="news"> <h2>Senest nyt - Side 1</h2> <?php foreach ($articles as $article) { ?> <h1 class="newsh1"><a href="article.php?id=<?php echo $article['Id'] ?>"><?php echo $article['title'] ?></a></h1> <p class="newstext"> <?php echo $article[ 'short'] ?> </p> <p class="newsby">Artikel skrevet af <a class="newsauthor" href="#!/page_More"> <?php echo $article[ 'author'] ?> </a>| <span class="newsdate"><?php echo date('j. F o', $article['date']); ?></span> </p> <div class="table"></div> <?php } ?> </div> <div class="oldernews"><span class="newsold"><a href="#!/Nyheder_page2"><strong>Ældre artikler ></strong></a></span></span> </div> </div> </div> </li>