GetSimple Support Forum
QUESTION [SOLVED] Get parent-page url in the post-pages loop - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11)
+--- Thread: QUESTION [SOLVED] Get parent-page url in the post-pages loop (/showthread.php?tid=16938)



[SOLVED] Get parent-page url in the post-pages loop - tuxy - 2023-01-24

Hello,

I do a lot of research and experiments if it is possible port my website to GS, here you see my test-website rebuild with GS.

Using parent-pages (template = category.php) also add this category-pages as menu-tem
The child-pages (template = post.php) are subpages from the category-pages

Adding a loop to the homepage that loop over the pages and shows only the post-pages.

This is the code i used and edit:
https://avinashsing.sunkur.com/2011/08/17/script-to-display-pages-or-posts-for-getsimple-cms-in-sidebar/

In the loop you can see that also the category-names (parent-pages) is adding, but how can add the parent-page-url in the loop?

Here you see the backend pages-tab:
[attachment=1667]

And this are a snippet from my code for the loop over the post-pages child-pages (try adding my code here, but doesn't work, so made a screenshot):
[attachment=1669]

In the XML-file there is only the name from the parent-page, but not the url to the parent-file, is there a way adding the parent-page url?

[font="Droid Sans Mono", "monospace", monospace]<parent><![CDATA[ontspanning]]></parent>[/font]


RE: Get parent-page url in the post-pages loop - tuxy - 2023-01-24

Hello,

Problem is solved!

This is my code for link to the parent (category-page)

<a href="'. $pagesArray[$count]['parent'] .'">'.$pagesArray[$count]['parent'].'</a>

Thatś the result:
<a href="LINK_TO_PARENT_PAGE">NAME_PARENT_PAGE</a>

Very strange that, with only the parent-page name <parent>..</parent> in the XML-file, print the **URL** and **NAME** with the same variable $pagesArray[$count]['parent']

Anyway, it works Smile


RE: [SOLVED] Get parent-page url in the post-pages loop - Felix - 2023-01-24

Code:
Hello,
Problem is solved!
This is my code for link to the parent (category-page)

<a href="'. $pagesArray[$count]['parent'] .'">'.$pagesArray[$count]['parent'].'</a>

Thatś the result:
<a href="LINK_TO_PARENT_PAGE">NAME_PARENT_PAGE</a>
Hi Tuxy,
I was going through my parent/child code snippets but you already beat me with it
Thanks for sharing your solution with us.
F.


RE: [SOLVED] Get parent-page url in the post-pages loop - tuxy - 2023-01-24

(2023-01-24, 21:44:32)Felix Wrote:
Code:
Hello,
Problem is solved!
This is my code for link to the parent (category-page)

<a href="'. $pagesArray[$count]['parent'] .'">'.$pagesArray[$count]['parent'].'</a>

Thatś the result:
<a href="LINK_TO_PARENT_PAGE">NAME_PARENT_PAGE</a>
Hi Tuxy,
I was going through my parent/child code snippets but you already beat me with it
Thanks for sharing your solution with us.
F.

Hi Felix,

No problem, happy it works now Smile)
How longer i expercience with GS how more fall in love with GS Smile
A few weeks ago, i was afraid, thinking it is old and not more updated/dead cms, but i see the community is very active, and with the GS CE, with the 'new' plugins, it is up-to-date, i love it!!!!
Ok, there are a lot of outdated code-snippets in the forum and outdated plugins/themes, but i can learn a lot with all this stuff.

Next challenge: find a solution for tags, and publication date. I know that GS stores the date, but every time i re-save the post/page it's update the pubDate, but i want a date that 'hold' the date when for the first the post is showing. Sometimes is needed update a post/page without changing the date.


RE: [SOLVED] Get parent-page url in the post-pages loop - Felix - 2023-01-24

Quote:Ok, there are a lot of outdated code-snippets in the forum and outdated plugins/themes, but i can learn a lot with all this stuff.

Yes but there is a community repository with plugins updated to php8.x
Have a look here:

https://github.com/getsimplecms-ce-plugins/
https://github.com/orgs/GetSimpleCMS-CE-plugins/repositories

Credits and Respect go to Shawn, Multicolor, Islander and everybody who contributed to this


RE: [SOLVED] Get parent-page url in the post-pages loop - tuxy - 2023-01-25

(2023-01-24, 23:05:42)Felix Wrote:
Quote:Ok, there are a lot of outdated code-snippets in the forum and outdated plugins/themes, but i can learn a lot with all this stuff.

Yes but there is a community repository with plugins updated to php8.x
Have a look here:

https://github.com/getsimplecms-ce-plugins/
https://github.com/orgs/GetSimpleCMS-CE-plugins/repositories

Credits and Respect go to Shawn, Multicolor, Islander and everybody who contributed to this

Yes,
I know from the awesome plugin repo's with php8.x compatible plugins :-)
Downloaded a lot from there ;-)
Hope the list with plugins growing.
I'm not a programmer, only what hobby-stuff, but will try developing or updating a plugin soon.

And...

A LOT OF RESPECT FOR THE GS (CE) TEAM FOR BUILDING AND SUPPORTING GS (CE)!!!!!!!