Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION [SOLVED] Get parent-page url in the post-pages loop
#1
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/1...n-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:
   

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):
   

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]
Reply
#2
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
Reply
#3
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.
Reply
#4
(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.
Reply
#5
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-...positories

Credits and Respect go to Shawn, Multicolor, Islander and everybody who contributed to this
Reply
#6
(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-...positories

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)!!!!!!!
Reply




Users browsing this thread: 1 Guest(s)