Displaying last post in home page
rcastellet
Member
dans Entraide
Hi,
I would like to display the last post in the home page of the site. Just the title, a few lines and a link to the post. Is there any easy way to do that?
Thanks in advance.
Regards.
Ricard Castellet
I would like to display the last post in the home page of the site. Just the title, a few lines and a link to the post. Is there any easy way to do that?
Thanks in advance.
Regards.
Ricard Castellet
Connectez-vous ou Inscrivez-vous pour répondre.
Réponses
Thanks for your help. The function you posted should go between php tags like this:
<?php
$plxShow->lastArtList('<h2>#art_title</h2><article>#art_chapo</article><p><a href="#art_url" title="#art_title">Read more</a>',1);
?>
Should I make any declaration? Am I missing anything?
Regards.
You just have to copy and paste the code in home.php in your theme folder.
Consultant PluXml
Ancien responsable et développeur de PluXml (2010 à 2018)
I want the post to appear in the home page of the web (I want to include the blog as part of the web).
I think I will do with your explanations. Otherwise, I'll will ask for your help again.
Thanks a lot!!!
Regards.
I have tried your code and it works correctly. But what I want is different. I want to leave the home page of the blog as it is. What I want is to show in another page of my website the last post of the blog. And the page I want to show the post in is the home page of the website not the home page of the blog. Hope I have explained well :-)
Thanks again.
Add a new one (choose the name you want, for example index).
Record.
Select column "home page" (on left), "active" (yes) and "hide" (on right).
Record.
2) In your theme folder, duplicate static.php file, rename the copy as static-home.php and put this code in it :
3) Go back to your administration panel, static pages, and clic on edit to edit "index" static page.
4) In the textarea, put this code : and select the template "static-home.php" you created at step 2.
Record.
In sidebar of administrative panel, a new link (blog) at the top of the page (near of back to site) have to be appear.
If you clic on back to site, you'll go to index page with one article.
If you clic on blog, you'll go to home page with 5 articles.
I hope you'll understand my bad english.
Many thanks. It works fantastically. Just a silly question because the text of the article does not show (?). I can see the title, the "read more", RRS link, etc. everything is fine except for that the text is not visualized. I haver reviewed your code and I think I have made no mistake but I am not able to spot the error. You can have a look if you are so kind here:http://www.bufetepedrola.com/blog/index.php?static2/index
Thanks in advance. Forgiven for your english :-) Mine is not much better. Regards.
It's because you didn't write in the "chapo" but in "content".
Done! Many thanks.
By the way, what is "chapo"?
Regards
When chapo is used, it appears on home page (with a "read more" link).
You have two options (when you write a theme) :
- either it's display before the body of an article on article page
- or it is not display on the article page, only on home page.
To write in the chapo, in the administration panel (new article), there is a link (chapo). When is clicked, a textarea appears above the textarea for content.
If chapo is empty, it is the all content that is display on home page.
I hope my explanation is understable :P
Regards
Your code is working great!
Just one more question. Last post appears in home page but when I click the title I want it to go to a page (html) that has a document frame with the blog in it. I can go to the page or to the blog but not to the page with the blog in it :-) Any suggestion?
Many thanks. Regards.
You can see what I mean here : http://www.bufetepedrola.com/inici2.html
If you click in the article, it will open the blog page with all the articles (http://www.bufetepedrola.com/blog.html). I have done this way because I don't know how to do that when you click the article in home page, the page that opens is the one of the article (http://www.bufetepedrola.com/blog/index.php?article8/article-6-li-europan-lingues-es-membres-del-sam-familie) directly. This way you can read the full article without having to click again.
This is important if you want to show in home page articles of a determined category. Then last article of the category shown in the home will not be the last in general in the blog page.
Hope I have explained.
Thanks in advance. Regards.
I see this is the way to display last article of a category in, let's say, home page. Perfect!
Now, what I want to achieve is to click in this article and go to the blog page and see the article opened (not the list but the article in full). See that my blog is shown in a html page via document frame. So the article url should have the instruction to open the page and then to show the article.
Thanks as always. Regards.
<?php $plxShow=plxShow::getInstance();?>
<link rel="stylesheet" type="text/css" href="<?php $plxShow->template(); ?>/style.css" media="screen" />
<section>
<div id="container">
<article role="article" id="post-<?php $plxShow->lastArtList('#art_id');?>">
<header>
<h1>
<?php $plxShow->lastArtList('<a href="http://www.bufetepedrola.com/blog.html" target="_parent" title="#art_title">#art_title</a>',1);?>
</h1>
</header>
<section>
<?php $plxShow->lastArtList('<article>#art_chapo(1000)</article>',1); ?>
</section>
</article>
</div>
</section>
As you see I have an absolute link to the blog page of the web that includes a document frame with pluxml blog in it. If I link to the article, then I go directly to pluxml blog without the parent page.
If I use #art_url then opens full article in pluxml blog but not in the page of the web where. The instruction should have to be : first, open the blog.html page, then, open the article in full. This is what I don't know how to do. Hope I have explained :-)
Thanks as always. Regards.
(y a pas une âme charitable qui pourrait aider là, car je sèche un peu ?)
Consultant PluXml
Ancien responsable et développeur de PluXml (2010 à 2018)
I know it is better without frames but it is much easier to integrate your blog via frames. You can see here (http://www.bufetepedrola.com/inici2.html) that it works quite good. The only problem is that when you click in the article url I don't know how to do to open the page blog.html with the article opened. An answer to this would make implementation of PluXml implementation much more flexible.
Thanks for your help. Regards.
I think the problem is from Serif WebPlus X6. No offense but you should learn html/css instead if you don't known.
Anyway, what is the file tree of your web site ? Maybe there is a solution without using iframe ?
No offense at all. On the contrary, my gratitude for your help. In fact I should learn html/css but at the moment I can't. Probably I'll do in a near future.
I know it is better without frames but, as always, it is a long story and the fact is that I am stuck with this :-)
Serif WebPlus X6 is a good software but not very flexible (they have a blog solution but PluXml is much better).
I don't know what do you mean by "the file tree of the site". Do you refer a to the structure of the site? It is pretty simple:
Home
Blog (testing)
Equip
Serveis
Pràctica Jurídica
...
Documentació
Contacte
Thanks again. Regards.
http://www.bufetepedrola.com/blog/index.php?article8/article-6-li-europan-lingues-es-membres-del-sam-familie
into the page
http://www.bufetepedrola.com/blog.html
by clicking a link from the page
http://www.bufetepedrola.com/inici2.html
I'm afraid in this case there will be no solution
Consultant PluXml
Ancien responsable et développeur de PluXml (2010 à 2018)
Many thanks. Regards.
1. Add the content of your homepage into a static page
2. Set this static page as the homepage (you have to check the appropriate checkbox in static pages administration - see column Homepage)
3. Use a static page template to define the look of the page (in your theme folder make a copy of static.php and name it for example static-homepage.php. Go to the options of your static page and select static-homepage.php in the listbox Template).
4. Now you can add specific modifications in static-homepage.php to setup the homepage
Hope this helps
Consultant PluXml
Ancien responsable et développeur de PluXml (2010 à 2018)
I have done the other way round. I have inserted index.php in the html page. No frames. And, for the moment, almost everything goes fine. You can see here: http://www.bufetepedrola.com/inici2.html. Now when you click the link of the article you go to read the full article :-)
Just a small (I think) problem. It is with pagination. If you see here : http://www.bufetepedrola.com/index.php and scroll to the bottom you will see the pagination. It works fine (onwards and backwards) except when you are in page 2 and you want to go backwards (to the first page). The link instead of showing the page (http://www.bufetepedrola.com/index.php?page1) just goes to http://www.bufetepedrola.com and then shows index.html page which is not the home of the blog. Instead of a relative url I should need a fixed one pointing to first page. Can you help me to do so?
Thanks to Jerry and you for your help. Regards.