Jump to content

_NameLess_

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by _NameLess_

  1. It's easier to use that way. In the template I only have to type this: <?php $SomeCarData = $page->whatever; $page->CarManufacturer->CustomFunctions->OutputCarData($SomeCarData); ?> Instead of doing everything myself: <?php $ClassName = SomeNonConflictingClassName; $Code = "class " . $ClassName . " {\r\n"; $Code .= $page->CarManufacturer->CustomFunctions; $Code .= "\r\n}"; eval($Code); $CustomFunctions = new $ClassName(); $SomeCarData = $page->whatever; $CustomFunctions->OutputCarData($SomeCarData); ?> The FieldType could handle all that. And I'd only have to write that code once and not everywhere I need the custom functions. Thanks again.
  2. Hi Macrura, I'd rather enter the code through the admin panel anyways because I want all the information of the manufacturer on one page without having to open another php file. The code is relatively short anyways so there is no real need for a whole file. The ACE Extended plugin you mentioned is a nice touch, though not strictly necessary i assume. Thanks you for your suggestions, seems like there is no other way than writing my own fieldtype.
  3. Hello, as an example imagine this structure: Templates: CarManufacturerTemplate Name: String CarTemplate Name: String Owner: String CarManufacturer: Page(where Template == CarManufacturerTemplate) Pages: CarManufacturers Manufacturer 1 [Template = CarManufacturerTemplate] Name = "Toyota" Manufacturer 2 [Template = CarManufacturerTemplate] Name = "Ford" Cars Car 1 [Template = CarTemplate] Name = "Car 1" Owner = "Steve" CarManufacturer = Manufacturer 1 (Shown as "Toyota") Car 2 [Template = CarTemplate] Name = "Car 2" Owner = "Bob" CarManufacturer = Manufacturer 1 (Shown as "Toyota") Car 3 [Template = CarTemplate] Name = "Car 3" Owner = "Jack" CarManufacturer = Manufacturer 2 (Shown as "Ford") So there are multiple manufacturers, multiple cars, and every car has a reference to its manufacturer. On the page mysite/cars/car-1/ I want to be able to present the data in a manufacturer-specific way but without doing something like this: <?php if ($page->CarManufacturer->Name == "Toyota") { //Show Toyota specific formatting } else if ($page->CarManufacturer->Name == "Ford") { //Show Ford specific formatting } ... ?> Instead I want to be able to give every child-page of the CarManufacturers-page some code which takes the required data as parameters and creates the formatted output on its own. This way, whenever I add a new manufacturer, I don't have to go through all the places which output manufacturer-specific data and add another if-statement. Instead I want to be able to write code on a per-manufacturer basis. A possible way of doing this would be a FieldType which allows me to enter PHP code in the backend. I'd add another field to the CarManufacturer-template: Templates: CarManufacturerTemplate Name: String CustomFunctions: MyCustomTypeWhichExecutesPHP And the backend page for Manufacturer 1 (Toyota) looks like this: |------------- | Name: | |-------- | | Toyota | |-------- | CustomFunctions: | |------------------------------------------------------ | | public function OutputCarData($SomeCarData) { | | //Show Toyota specific formatting | | } | |------------------------------------------------------ And in the template-code of CarTemplate I can just do this: <?php $SomeCarData = $page->whatever; $page->CarManufacturer->CustomFunctions->OutputCarData($SomeCarData); ?> And I don't need to change that code at all when I add another car manufacturer. I just type in another function OutputCarData which does the formatting appropriately. I hope there is a simpler way for this than creating a custom FieldType. If you have any further questions feel free to ask and I will try to answer them or provide more details in what I want to achieve. Many thanks, _NameLess_
  4. Hello, I am reading this forum for quite a while now.. and try to stay and help where I can. But I have to learn it first. I tried your solution and IT WORKS! Many times a solution is much more simply than one is thinking. Normal installation. No custom path involved Thanks again! I tried to dig up a few things and only found out that the "FieldtypeComments"-module is not loaded when looking via debug-tools -> modules. Therefore I assumed there is some error. Should I write this bug report or will you/ryan? Also maybe good to work on: If CommentsManager is installed, it is impossible to uninstall. And it is also impossible to uninstall the CommentsModule as CommentsManager is installed. => You really need a field, to uninstall. I think install/uninstall should work without the needing of a field. Have a nice day!
  5. Am I really the only one who got this problem? No one here who can help me get the Comments working?
  6. Short Update: I debugged it to the best I can and I found out that the problem lies directly with the Comment Fieldtype. The module after install is not recognized as loaded. To be precise: It is not listed under "installed modules" in the debug tools. It says it is installed though. So, as the required module is not loaded. It is of course not possible to load/find the Comment-class. I will try to look into it more but I think this might be the end for me as I don't know where modules are loaded.
  7. As I don't know what post fits better I decided to post updates in mine. Link: https://processwire.com/talk/topic/12194-comments-manager-module-error-usinguninstall/ EDIT/UPDATE: If you just want to delete and not use this module, you can replace a few values in the .module file, uninstall it and revert the replaced stuff. File location: \wire\modules\Process\ProcessCommentsManager\ProcessCommentsManager.module Comment::statusApproved => $this->_('approved'), Comment::statusPending => $this->_('pending'), Comment::statusSpam => $this->_('spam'), Comment::statusDelete => $this->_('delete') To the following: 1 => $this->_('approved'), 0 => $this->_('pending'), -2 => $this->_('spam'), 999 => $this->_('delete') There are 3 more "Comment::statusDelete". Just replace them with 999 and you are good to go. After this, upload the changes. You can now uninstall the module. Afterwards, just revert the changes and upload again. Clarification for the values: The "Comment"-Class is located under: \wire\modules\Fieldtype\FieldtypeComments\Comment.php There are constants declared. Have fun ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- EDIT: Kongondo pointed out our mistake. The problem is that we don't have a field for comments yet. Therefore the error fires. To uninstall: 1. Create a new field from the type "Comments". 2. Uninstall CommentsManager 3. Delete Field created in 1... 4. WIN
  8. So, did you find a solution? Got the same problem with 2.7.2
  9. Hello, thanks for the help the other day. I continued to configure/code my page like I want it. Now i was going to add comments. I installed the Comments Manager Module under "processwire/module/edit?name=ProcessCommentsManager". It got installed and I can see the menuoption under "setup", called: Comments. Problem: It does not matter what link I press. Everyone shows the following error. Even uninstalling shows this error. Page: /processwire/setup/comments/ Error: Fatal error: Class 'Comment' not found in /var/www/testsite/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.module on line 80 I am using Processwire 2.7.2. Is anyone here who can help me sorting this problem out? Best regards EDIT: I just realized that this might be the wrong section of the forum. If so, please move this thread. Thanks!
  10. Many thanks for the help. Is this the "perfect" way or does someone else has another idea, some input for me?
  11. Hello guys! First of all I'd like to thank everyone here for helping, being active and making me love this CMS. I used it at work for a website and directly fell in love with it. Therefore I am now planning a few things and I was wondering what the best way to implement them might be. 1. This is kinda hard to explain. Maybe the easiest way is to think that I want to "track" a users progress. To make it easier to understand let's assume I have "Series" (Information about this series..) and "Episodes" (Information about this Program/Episode). I know from Drupal there is "Entity Reference" and so on... BUT in Processwire I would go with the page-tree "flow": - Home - Series - NameOfSeries - Episode Foo - Episode Bar - NameOfOtherSeries ... As this worked for me quite well I want to play with another feature. It's "subscribing". A user can add a series to his personal lists to keep getting updated and "save" the current status (In this example maybe a watched episode count..). The only way I came up with is to create a Page called something like "Favorites" and each Subpage contains an ID, Episode Number, Name of Series, User, That wouldn't be that hard to implement. Afterwards I can simply search through the Subpages and find users that watched episode X, users that watched series X, etc.. whatever I want to track. The problem here is that I want to plan for the near future and say: 2,000 "Series" 30,000 "Episodes" 50,000 Users Plan A: Each User tracks 20 Series = Would be 1 Million Subpages ONLY (!) if I track a user <-> series relationship. Plan B: But If I want to track a user <-> Episode relationship (which is in my opinion the way I want it to work) the following would happen... Again 20 Series.. with a little math.. are something like 300 Episodes PER user. To sum it up: 15,000,000 Subpages. So.. I really like this system but I think it will meet it's end here. Does anyone have an idea how I would be able to implement such a system? 2. On many occasions I found out that I need a few checkboxes. Now I want to represent them with Pages (read this somewhere that it's nicer and as far as I understand processwire I like this approach) but I don't know how to "set them up". How do you guys manage this? A "tools"-page with Subpages that for example (again series/episodes from above) contains the checkboxes? - Home - Tools - Language - German - English - Duration - 10 Minutes - 20 Minutes - Genre ... Or do you have any other/better ideas? 3. Are there any good SSO solutions for Processwire in connection with a forum software? Best regards, _NameLess_ PS: I don't know if this is the best place to ask. I tried forum search before but it didn't really return things that helped me. Also maybe it's better to split this in two separate Threads. If so, feel free to do it or just tell me/pm me and I will change it ASAP.
×
×
  • Create New...