Hajosch
Members-
Posts
9 -
Joined
-
Last visited
Profile Information
-
Gender
Male
-
Location
Potsdam
-
Interests
Anarchy, Nature, Literature
Hajosch's Achievements
Newbie (2/6)
6
Reputation
-
Help needed: Link to or search in multiple fields
Hajosch replied to Hajosch's topic in Getting Started
Hello Jens, thanks for the additional tip. You are right. My basic problem is the lack of PHP knowledge. So far, I've managed well with Processwire and other CM systems (Joomla, Wordpress) in using existing code examples when developing my own websites, or I've found an extension that solves the problem. Unfortunately, I haven't found an example of how to solve the specific problem I described here in the PW forum or in the published PW profiles. And also the tips given in your last posting I could not implement successfully. I would like to assign a programmer with good PW knowledge for the solution of this problem and of course I would like to pay a regular fee. But the website, which I develop with friends, is a non-commercial project (of anarchy and anarchism research), which unfortunately can't count on public financing either. Nevertheless, I would pay a small fee of maximum 50 EUR (via Paypal) for the solution of the problem in order to get on with the development of the project as soon as possible. For this I would give the person who wants to solve the problem access to the development website. I would be happy if someone could help me with programming and solving my problem. You can contact me via my PW profile. Thank you and kind regards Hajosch -
Help needed: Link to or search in multiple fields
Hajosch replied to Hajosch's topic in Getting Started
@jmartsch Hello Jens, thank you for your tips. And YES, I want all publications to be displayed for which the name you click on is either the author or the editor. In order to implement your suggestions correctly, unfortunately I lack enough PHP knowledge. Specifically, I don't know where to put the "$pages" and where to put the selector recommended by you in the source code, so that the function works as desired. Could you or someone else, who stumbles over this post, give me the code to install the selector based on my template file? I'll insert the complete source code of the template file "publication-page.php", which I use to display the titles. Thank you and have a nice Sunday Hajosch Here the source code of the template file: <?php namespace ProcessWire; /**ABRIDGED SOURCE CODE OF PUBLICATION-PAGE.PHP */ /**for full code ask PW-User: Hajosch */ /** @var Page $page */ $authors = $page->get('authors'); $editors = $page->get('editors'); $subtitle = $page->get('subtitle'); ?> <div class='uk-grid uk-grid-medium'> <div class='publication-images uk-width-medium-1-3 uk-text-center'> <?php include('./publication-page-images.php'); ?> </div> <div class='uk-width-medium-2-3'> <h2><?=$page->title?></h2> <h3><font color=#dd1111>Bibliografische Darstellung mit Feldkennungen</font></h3> <!-- Query of the authors & editors --> <?php if($page->authors->count) echo "<u>Autor*in/nen</u>: "; echo $page->authors->implode("; ", "<a href='{url}'>{title}</a>"); ?> <?php if($page->editors->count) echo "<u>Herausgeber*in/nen</u>: "; echo $page->editors->implode("; ", "<a href='{url}'>{title}</a> (Hrsg.)"); ?> <br><u>Titel</u>: <?=$page->title?> <!-- Feldabfrage mit IF-Abfrage (Feld nur anzeigen, wenn Inhalt) Lösung aus PW-Forum --> <?php if($subtitle): echo "<br><u>Untertitel</u>: $subtitle"; endif; ?> <!-- Ende der Darstellung mit Feldkennungen --> </div> </div> -
Dear PW Experts! I am a PW beginner and have only little PHP knowledge. Since I haven't found a solution for my problem here in the forum despite intensive searching, it would be nice if I could get support from the experts to solve my problem. THE INITIAL SITUATION: With ProcessWire (3.0.98) I am developing an online bibliography in which certain data fields (e.g. author and editor) are displayed as links in the frontend representation of a title. See screenshot 1: yellow marks the names of the 2 authors, green marks the names of the editor). For example, if you click on the link of the author's name, all titles of this author will be displayed. The same is true for the name of the editor. For this I have set up the following fields and templates: 1. for the authors: field: author, template: authors 2. for the editors: field: editor, template: editors The linking of the name and the search for the name is realized by the template file 'publication-page' as follows: <?php namespace ProcessWire; /** @var Page $page */ $authors = $page->get('authors'); $editors = $page->get('editors'); [. . .] <!-- Query of the authors and editors --> <?php if($page->authors->count) echo "<u>Autor*in/nen</u>: "; echo $page->authors->implode("; ", "<a href='{url}'>{title}</a>"); ?> <?php if($page->editors->count) echo "<u>Herausgeber*in/nen</u>: "; echo $page->editors->implode("; ", "<a href='{url}'>{title}</a> (ed.)"); ?> The separate search for authors and editors by link works without problems. If you click on the author's name, all titles of this author will be displayed. The same works for the names of the editors. THE PROBLEM: So that the user does not have to perform separate searches for authors AND editors, the search for the linked name should be performed simultaneously in 'authors' and 'editors' to display all titles that have been entered under this name either as authors or as editors. So I want a function like the one used in the full text search with a selector definition as follows: // if there are keywords, look in the following fields for the keywords (search terms) if($input->get('keywords')) { $value = $sanitizer->selectorValue($input->get('keywords')); $selector .= "title|subtitle|authors|editors|publisher|place|tags|body|contents_table%=$value, "; $summary["keywords"] = $sanitizer->entities($value); $input->whitelist('keywords', $value); } This works in the full text search. All titles with the same name as author and editor are displayed simultaneously. MY QUESTION: How do I change the definition of the variables and the definition of the name display of the author and editor so that both the author's name and the editors name generate a link that searches both data fields (authors and editors) simultaneously and displays the corresponding titles for both the author and the editor in a search result? I tried by changing the variables for authors and editors in the following way: $authors = $page->get('authors|editors'); $editors = $page->get('editors|authors'); But that didn’t work. I am grateful for every tip. Thank you and best regards from Potsdam/Germany Hajosch
-
Hi OLSA, thanks. Also your solution to call the Comments css and js files is working fine - and the result looks good! I'm becoming more and more a real fan of ProcessWire and its helpful user community. Hajosch
-
Hello, Zeka, thank you, that was the right assumption. Being a PHP dilettante, I didn't know how to get the stylesheet for the comments module correctly. I finally tried the following code: <!-- Anfang Kommentar- und Page-Rating-Formular --> <link rel="stylesheet" href="/wire/modules/Fieldtype/FieldtypeComments/comments.css"> <?php echo $page->comments->renderAll(); ?> <!-- Ende Kommentar- und Page-Rating-Formular --> And now the star rating function works as it should (see screenshot in the attachment). Thank you and best greetings to Kiev! Hajosch
-
Hi encho and Zeka and everybody else who reads my posting. I have the same problem like encho: The comments function works well, but If you include custom code {stars}, stars are displayed but not correctly. It shows 5 star only regardless of the rating. I am using this code: <?php echo $page->comments->render(array( 'headline' => '<h3>Comments</h3>', 'commentHeader' => 'Posted by {cite} on {created}{stars}{votes}', 'dateFormat' => 'd.m.Y H:i:s', 'encoding' => 'UTF-8', 'admin' => false, // shows unapproved comments if true )); In the attached screenshot you can see the result. Does anyone have any idea how to get the Star Rating function to work correctly?
-
Help with IMPLODE (different output of last page)
Hajosch replied to Hajosch's topic in Getting Started
Hello Soma and everyone else who helped me to solve my problem. SOMA: Thanks for your suggestion, which also works well and which I took as standard because of the shorter code. It's amazing how many different solutions Processwire has to offer. I've learned a lot. Thanks again to everyone and best regards Hajosh -
Help with IMPLODE (different output of last page)
Hajosch replied to Hajosch's topic in Getting Started
Wow. This is an incredible feedback and an amazingly friendly forum. I thank everyone who took the time to offer me a solution to my problem. I have now started with the first solution of teppo (the implode() method of the WireArray class), and it worked immediately. Thank you, thank you and thank you again! I will now have another thorough look at the other solutions proposed by Dragan, AndZyk and OLSA and then give you a feedback that may also help other users who stumble across the same problem. Thank you very much and have a nice day! Hajosch -
Hello everyone! I am an absolute ProcessWire novice and unfortunately I don't have too good PHP knowledge. Nevertheless, I have made good progress with the development of our ProcessWire website thanks to this helpful forum. But now I have a problem with the formatting of field queries, where I still haven't found a solution after 2 days of searching. I have a field "authors", which is created as type: PageReference / MultiplePages. I would now like to query all authors of this field who are saved for a single book title. This works well with the following query: <!-- Query of the authors --> <?php if (count($page->authors)) { echo "<u>AUTOR/EN</u>: "; foreach($page->authors as $authors) { echo "<a href='{$authors->url}'>{$authors->title}</a>; "; } } ?> Starting with the first author, each of the following authors is inserted a semicolon to separate the names of the individual authors. That works correctly. But I would like to have a dot after the last author, not a semicolon. So I want to get a result like this: Author-1; Author-2; Author-3. In the meantime I found out on this forum that the command 'implode' can be used for this. But I simply can't implement this solution in my specific case due to lack of PHP knowledge and I haven't found any patterns that I can use for my type of field query. So I would be very grateful for support. Where do I have to insert the command 'implode' with which additional parameters in my code? It would be great if someone could help me by showing me how to change the code of my previous field query. Thank you and best regards Hajosch, Potsdam/Germany