Jump to content

ridgedale

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by ridgedale

  1. @Robin S Please don't apologise. Your assistance has been extremely helpful. I didn't need to execute the API code as I had already gone through all the posts and manually corrected them. The solution was to remove <page id> - from the name field, make any changes and then save them. However, the updated code you have kindly provided resolves the issue and avoids having to do that in future. Many thanks again for all your help.
  2. @Robin S Just come across an issue with the hook code. If a post needs to be updated, an additional id is added to the name for example after one change and save the name becomes: <id>-<id>-<post-title> and after four changes it becomes <id>-<id>-<id>-<id>-<post-title>. Is there any way to avoid this other than resolving the issue by directly editing the database to remove the unwanted additional ids? Or removing the id from the name before saving the edited post?
  3. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. Please could someone advise what the process is to organise the blog posts under the admin login to avoid very long, random lists of posts. My immediate thought is to have the posts listed in groups by year and month, but I cannot see how tit might be possible to do that.
  4. Please could someone explain how to mark a topic as solved. This does not appear to be covered by the guidelines.
  5. @Robin S, Thanks for you help. For some reason the page names are now working. There appears to have been some delay before the post names were updated. Plus I needed to review and amend the database entries for the posts where the post names were scrambled/junked during testing. Many thaks to everyone for all their input.
  6. Hi Robin S, I haven't changed the name of the template. The blog-post template name is blog-post.
  7. @Robin S, I can see that /site/ready.php is called by uncommenting: /** @var ProcessWire $wire */ but when that line is uncommented and the file includes the code provided I'm still only getting the page title returned. Any thoughts on where I'm going wrong?
  8. @dragan, Thanks for your reply. I'll do that. @Robin S, That is probably where I have been going wrong. I've tried your hook method. When I created _ready.php under site > templates, added the code you provided, updated the blog_post template prepending _ready.php and refreshed the webpage, the path /blog/<id - title> did not not get prersented as expected. In addition, when I clicked on the browser back button the code from the _ready.php file ended up being displayed on the page behind the navbar. The documentation is a little confusing as the document you linked to suggests /site/ready.php: but the templates suggest the file should be placed under /site/templates/. I'm assuming the /site/ready.php file is just an example file. Is that correct?
  9. Hi Robin S, Thanks for the update. The confusion has arisen because when id or $id is entered into the Name format for children field it does not return the Page id! /blog/0919/ /blog/2619/ These appear to be randomly generated Names using id or $id!
  10. Hi Robin S, Thank you for the feedback. However, the issue remains that $id generates a random number instead of an auto-incrementing sequential number. This forum's posts do appear to have ids being created that are auto-incrementing sequential numbers. The only thing I can think of is to add a custom separate id field in the backend database that produces auto-incrementing sequential numbers to be used for the blog posts only. However, my concern with that is it might completely break the site. Any input on how the auto-incrementing sequential ids for the forum posts are achieved would be appreciated.
  11. Hi dragan, Thank you for your reply. However, I really would like to avoid deploying modules where possible particularly as it should be completely unnecessary in this case. I'm sure it should just be a case of changing a setting or adding some code. What I simply cannot understand is why $id generates a random number. There must be a reason for that, but I cannot find an explanation. In all my experience with database development ids have always been generated as auto-incrementing sequential numbers. If anyone can shed some light on why $id generates a random number, it would be very much appreciated.
  12. Hi kongondo, No problem. However, as a senior member of the community, I wonder if you might know how the posts in this forum are generated with sequential ids followed by a dash and then the post title. Entering $id into the Name format for children field returns a random (currently 4-digit) number (id) which is not what I'm after. Any assistance on that would be greatly appreciated.
  13. Thanks, gmclelland. Selecting the No date/time picker option allowed the editing of the time. Interestingly though, if the date only is changed the time defaults to the current time, so if the field content is changed and the time is important both the date and time must be entered and saved. Did you remove the original date field from the template as well?
  14. I realise that but I have to copy and paste a long list of old posts from another CMS into PW3, so it is not possible to simply work through the list and add the old posts unless I audit the list and sort it into timestamp order before I start. If I could create a time field that can be manually editted that might help.
  15. I've also tried adding a new datetime field but that does not work either. When I select the date output format as yyyy/mm/dd the field is actually formatted as yyyy-mm-dd. Plus irrespective of what is selected for the time output format the time is rendered as a zeroed time - 00:00:00! A biut of a headache at the moment!
  16. Hi kongondo, Thank you for your reply. However, Unless I'm mistaken, I'm not using the Blog module. The Blog module has not been added under wire/modules or site/modules.
  17. Thanks again, gmclelland. Now it makes sense. However that does mean that my solution does not actually work for adding back old posts because the created date is actually the present date and time. The problem with when the Sort settings for children > Children are sorted by is set to date (default setting) is that zeroed time-stamps are generated. So posts set as being on the same day end up being randomly sorted. I don't know if it possible to change date to include H:i:s. I'll have a look at that. Update: No, H:i:s cannot be added in the date field.
  18. Thanks for all your input, gmclelland. It is very much appreciated. After messing around creating numerous posts I have come to the conclusion that entering $id into the Name format for children field returns a random (currently 4-digit) number (id) which would be fine except that when the Sort settings for children > Children are sorted by is set to date (default setting) and the reverse sort direction? setting is checked the blog posts generally are sorted correctly by date except for blog posts created on the same day. Blog posts created on the same day appear to be being sorted by the name which in this case is the randomly generated $id. If the randomly generated id is lower than an earlier post on the same day, it will not appear in the correct sort order. The solution to that issue is resolved by changing the Sort settings for children > Children are sorted by is set to created instead. Then the posts will appear in the correct sort order. My first thought is why on earth is the $id being generated as a random instead of incremental number?! Secondly, please could someone explain where the blog post and page data are stored in the database? I've looked and must be missing something because I can't find the data.
  19. A new post with $id $title typed into the Name format for children field and saved produced: /blog/0319-310331fridayeurope-london/ That does not make sense because I would have expected $id to have incremented by 1 and the 310331 cannot likewise be a timestamp as the figure has actually reduced. :? I've tried to check the database to see where the data is actually stored but have not been able to locate it.
  20. Doh! Sorry, my eyes must be going! When I typed in simply id-title the page path was returned as exactly that: /blog/id-title/ When I changed the text to $id-$title the following was returned: /blog/3419-313431fridayeurope-london/ I am assuming 3419 is the page id and the hyphen returned is correct but I'm not sure what the rest is referring to. Is it a timestamp in seconds followed by the day name and time zone? If that is the case $title is not the variable I'm looking for. Any further thoughts?
  21. Thanks for your suggestions, gmclelland. I don't see the Name format for children field you are referring to. I've attached screen grabs of what I see when I view the blog and blog-post templates' Family tab. I would be happy to delete and manually reinstate the posts, if necessary, and would like to avoid using a module, if possible. Any thoughts?
  22. Hi Robin, Thank you for your reply and the suggestion. I realise belatedly my original proposal for the blog post path to be /blog/<year>/<month>/<blog-post-title> doesn't prevent the possibility of potential of clashing post titles. I now believe it would be better to simply add the blog post id as a prefix to the post title such as is deployed in this forum. e.g. https://processwire.com/talk/topic/- and therefore achieve something along the lines of: /blog/<post-id>-<post-title> but as on the Processwire Forum only display the <post-title> on the actual post page. That way posts could be made using the same title and be uniquely identified. Do you or anyone else know how this is achieved?
  23. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. The issue is that blog posts for the particular site in question are automatically formatted as /blog/<blog-post-title>. It is evident the path format should have been configured as /blog/<year>/<month>/<blog-post-title>. Please could someone advise whether or not it is possible to change the path format for the blog posts of an existing active site that uses the regular profile? Any assitance would be greatly appreciated.
  24. Hi Macrura and Klenkes, Thanks for your feedback. Much appreciated.
  25. Further extensive research revealed the solution to be to use the following code referring to the Page path and field reference rather than the field reference: <?php echo $pages->get("/site-prefs")->siteChairperson; ?>
×
×
  • Create New...