Page 1 of 1
How to link to blog posts using Info Pages?
Posted: Tue Oct 24, 2023 11:11 pm
by lecarlb
Hello,
I'm not sure if this has been answered already and I've searched the forums but may have missed it. I've created the Blog folder and blog slug but my memory needs refreshing.
I need advisement with:
a) creating the actual page where the blog posts will appear
b) the link in the footer to the blog page where the posts will appear
Please share how you've done it. Thanks in advance.
Re: How to link to blog posts using Info Pages?
Posted: Tue Oct 24, 2023 11:32 pm
by burt
Simplest;
lecarlb wrote: ↑Tue Oct 24, 2023 11:11 pm
a) creating the actual page where the blog posts will appear
Is already existing; info.php?pages_id=x
where x is the ID of one of your blog posts.
b) the link in the footer to the blog page where the posts will appear
All you need is some module made to list the pages that are in your "blog" folder.
Maybe a box? Maybe a footer? Maybe a navbar dropdown?
--
Or you can of course go more complicated and make a new blog.php page which shows only the info_pages in your blog folder. Update the canonical header tag module appropriately. And so on.
Re: How to link to blog posts using Info Pages?
Posted: Tue Oct 24, 2023 11:41 pm
by lecarlb
burt wrote: ↑Tue Oct 24, 2023 11:32 pm
Simplest;
lecarlb wrote: ↑Tue Oct 24, 2023 11:11 pm
a) creating the actual page where the blog posts will appear
Is already existing; info.php?pages_id=x
where x is the ID of one of your blog posts.
b) the link in the footer to the blog page where the posts will appear
All you need is some module made to list the pages that are in your "blog" folder.
Maybe a box? Maybe a footer? Maybe a navbar dropdown?
--
Or you can of course go more complicated and make a new blog.php page which shows only the info_pages in your blog folder. Update the canonical header tag module appropriately. And so on.
What is the perfect model to use to create a module to list the pages that are in the blog folder? Thanks for the quick reply.
Re: How to link to blog posts using Info Pages?
Posted: Wed Oct 25, 2023 3:44 pm
by burt
I'm not sure what you're asking...
Options include all those I previously mentioned as well as any others you can think of (eg a PI module for index).
Re: How to link to blog posts using Info Pages?
Posted: Wed Oct 25, 2023 4:18 pm
by lecarlb
burt wrote: ↑Wed Oct 25, 2023 3:44 pm
I'm not sure what you're asking...
Options include all those I previously mentioned as well as any others you can think of (eg a PI module for index).
I'm sorry. I guess I meant the page that will list the blog topics. Is there anything available that can be used as a model to build, for example, blog php? Or will any of those you've mentioned need to be built from scratch?
Re: How to link to blog posts using Info Pages?
Posted: Thu Oct 26, 2023 3:50 am
by heatherbell
lecarlb wrote: ↑Wed Oct 25, 2023 4:18 pmpage that will list the blog topics.
app.php/addons/paid_addon/info_index_in ... t_modules/
Re: How to link to blog posts using Info Pages?
Posted: Thu Oct 26, 2023 4:15 am
by lecarlb
Thanks. I'll give it a go soon. I can see how it can be used as a blog.
What Phoenix versions has this been tested on?
Re: How to link to blog posts using Info Pages?
Posted: Thu Oct 26, 2023 9:40 am
by burt
I'm still a bit hazy on what you're wanting to achieve. It sounds like you want to use the info_pages system to run a Blog? Those blog posts would be viewable in the shop side on info.php
You therefore just need a module built (I've listed a few ways in previous posts in this thread) which shows a list of recent "blog" posts linked to (eg) info.php?pages_id=4 or whatever. This list of links would be done using the Container system - example [
https://github.com/CE-PhoenixCart/Phoen ... hp#L14-L20 ] something like;
Code: Select all
$pages = info_pages::getContainer(['pd.languages_id' => '1', 'p.folder' => 'blog', 'p.pages_status' => '1']);
Which says...make a container that holds;
pages in the blog folder
english
published
The container system appears more complicated than it really is. All it really dies is allow shopowner to write SQL without actually writing SQL.
Once you have a container of $pages, outputting them (in the module template file) is very easy;
Code: Select all
foreach ($pages as $k => $v) {
echo $v['pages_title']; // outputs the title
}
Obviously add in bootstrap HTML to make it pretty, etc
--
As I already mentioned, you
might want to split out the blog posts into their own "blog.php" page. It would need to custom coded. The general idea would be to have a blog.php page which lists "X" number of your recent blog posts, maybe an excerpt of each [same idea as above, container] - with a "read more" link. The read more link would link to the full blog post; blog.php?id=4 which would show the full content of blog post.
Re: How to link to blog posts using Info Pages?
Posted: Thu Oct 26, 2023 9:57 am
by lecarlb
burt wrote: ↑Thu Oct 26, 2023 9:40 am
I'm still a bit hazy on what you're wanting to achieve. It sounds like you want to use the info_pages system to run a Blog? Those blog posts would be viewable in the shop side on info.php
You therefore just need a module built (I've listed a few ways in previous posts in this thread) which shows a list of recent "blog" posts linked to (eg) info.php?pages_id=4 or whatever. This list of links would be done using the Container system - example [
https://github.com/CE-PhoenixCart/Phoen ... hp#L14-L20 ] something like;
Code: Select all
$pages = info_pages::getContainer(['pd.languages_id' => '1', 'p.folder' => 'blog', 'p.pages_status' => '1']);
Which says...make a container that holds;
pages in the blog folder
english
published
The container system appears more complicated than it really is. All it really dies is allow shopowner to write SQL without actually writing SQL.
Once you have a container of $pages, outputting them (in the module template file) is very easy;
Code: Select all
foreach ($pages as $k => $v) {
echo $v['pages_title']; // outputs the title
}
Obviously add in bootstrap HTML to make it pretty, etc
--
As I already mentioned, you
might want to split out the blog posts into their own "blog.php" page. It would need to custom coded. The general idea would be to have a blog.php page which lists "X" number of your recent blog posts, maybe an excerpt of each [same idea as above, container] - with a "read more" link. The read more link would link to the full blog post; blog.php?id=4 which would show the full content of blog post.
That's what I'm thinking about. I didn't know how to articulate it well. Thanks