Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by mr-fan

  1. some little example code how i hacked the "prefilling" option into the seo_fields from own content fields....if i've the time i transform it to a simple module with some settings for the fallback fields...what this code does: it take a look only if a user publish a page and if seo_title , desc, keywords are filled....and if not it uses several text fields that the templates provide as an fallback that the seo_ entries not empty - so you think why - The smart settings in the module do that on frontend, too! Yes but a editor that takes a look at the SEO Tab see it empty with some strange example text....and i wanna let see him what will be the output in frontend. I don't like empty fields while in frontend some magic works that nobody see at a first glance. This is what i meant with - fill the "smart" things in the page fields if the user doesn't set them...or i'am thinking to complicated here? regards mr-fan code runs in admin.php - some functions for better striptags and some other functions to get the right output.... /** * Hook for changing seo_* fields if empty on Page Publish */ $pages->addHookAfter('saveReady', null, 'changeSeoFields'); function changeSeoFields(HookEvent $event) { $page = $event->arguments[0]; //for this template only if($page->template == 'artikel'|| $page->template == 'seite') { // page is about to be published if($page->isChanged('status') && !$page->is(Page::statusUnpublished)) { // check if seo_title fields are exist and if they are empty if (!$page->seo_title) { //get the default value that would used as fallback if ($page->headline) { //Headline field is used for seo_title $default_title = ripTags($page->headline); } else { //Headline field empty - page title is used $default_title = ripTags($page->title); } //set seo_title on publishing $page->set ('seo_title', $default_title); } // check if seo_description fields are exist and if they are empty if (!$page->seo_description) { //get the default value that would used as fallback if ($page->kurztext) { $default_desc = ripTags($page->kurztext); } else { //is there a main content block as pagetable field pt_inhalt? if(count($page->pt_inhalt)>0) { //get the first text field in the pagetable and use it for the seo description $first_item = $page->pt_inhalt->get("template=part_text|part_text_image_left|part_text_image_right"); $first_content = ripTags($first_item->text); $default_desc = wordLimiter($first_content, 160); } } //set seo_description on publishing $page->set ('seo_description', $default_desc); } // check if seo_keywords fields are exist and if they are empty if (!$page->seo_keywords) { //get the string that should be used to generate automatical keywords for this page //we use all textfields in the pagetable from the main content and collect them $keyword_texts = ''; //is there a main content block as pagetable field pt_inhalt? if(count($page->pt_inhalt)>0) { foreach ($page->pt_inhalt as $keyword_text) { if ($keyword_text->title) $keyword_texts .= $keyword_text->title; if ($keyword_text->text) $keyword_texts .= $keyword_text->text; if ($keyword_text->text2) $keyword_texts .= $keyword_text->text2; if ($keyword_text->text3) $keyword_texts .= $keyword_text->text3; } } else { $keyword_texts = $page->headline.' '.$page->kurztext.' '.$page->title; } //rip tags $keyword_string = ripTags($keyword_texts); $default_keywords = extractKeywords($keyword_string); //set seo_title on publishing $page->set ('seo_keywords', $default_keywords); } } } }
  2. Thank you very much - works great - always getting an error with ->first() or something else...since it is not needed and with get the first item with given selector is there! I'm working on a kind of contentbuilder PageTable that works as replacement for the main body field with a stripped CKE and own templates for the contentblocks...and i used to get some kind of teaser so i was searching for the first text element in the different blocks! Thanks again - regards mr-fan
  3. Just a shot question... How can i get the first item of a PageTable field with a specific template pages are stored central hidden admin page...and i nedd this in a function to get the first text field of a multiple contenttype PageTable example: PageTable field = pt_contents -> i wanna get access to the fieldentries of the first item of pt_contents with the template part_text? i'm little stucked...
  4. Martjin was faster while I'm fighting with my touch screen....:-( Just ask exactly your usecases with a good description and there will be a solution ....the administration interface from pw is just API and pages like everything else...
  5. Just short from mobile....;-) Processors provide all option to create a simple user interface....build for every specific project separate.... Just some points on this to search some reading stufff...may I link it later.. - family tab settings - template permissions - make intensive use of the "add new" button....my clients log in after two months and click just....add new select article/page/document... - even create a simple administration dashboard is easy like creating a template for the backend....there are some modules on this topic... - its even possible to change the process of the "pagelisttree" to use Lister pro module ......much more option on this and every turn is on the one who use and setup the system for the client.... ;-) Regards mr-fan
  6. Since a Repeater item is a kind of page the numbers are the id's of the extries of the repeater... so have a closer look at: https://processwire.com/api/fieldtypes/repeaters/ like in the example you have to call the fields like: foreach ($page->info_tabs as $tab){ echo "<div>"; echo $tab->title; //or if you have a special text field echo $tab->myFieldName; echo "</div>"; } regards mr-fan
  7. Some code or screen would make shure that you've get the right answer. - Where you put umlauts in which input (frontend form ->Code example?) - How do you use the url segment code example - are you using the name attribute of the $page and not the title? ...regards mr-fan
  8. Did just PR the german translation of this great module... https://github.com/Manfred62/pw-modules-lang-de/pull/1 proud to contribute with some translation. One Feature request comes in my mind - that would be a nice to have - and for my installations i probably would challange this with some little hooks on page saving...and some hacking - but within the moduel it would be much better. feature of the "smart" title|description would be: ->if some smart fields are set -> that on first page publish -> if no SEO fields are filled out by the user ->the smart title|desc should filled in the seo_ fields This has the benefit that the Google Preview would work and simple editors see what really would generated at frontend -> and they can improve this output with own entries in the seo_fields.... i think this would be a hook after page save and Page::statusUnpublished.....but i'm not so expirenced to edit such a complex module...i'm just able to hack a little bit with my (german: gefährlichem Halbwissen) regards mr-fan
  9. should be no problem using this code from ryan: https://processwire.com/talk/topic/245-automatic-visit-count-5k-visits-a-day/#entry1661 regards mr-fan
  10. In my former CMS there was a little counter addon that setup a little table with views/clicks and timestamp...that was easy to use for small addstatistiks....but i'll not create a separate tracking system if i have one that could do the job. For my smaller websites i simple use the "views" counter of the guests group and show them in a simple Lister called "visitorstats" so the more or less editors can see counts of the homepage and importand pages for visitors....nothing facy but some small help and it's a single field on every page that is incremented on view. Since i've a PIWIK Installation ready to go i could get hands dirty on the event tracking API..... http://developer.piwik.org/api-reference/tracking-api even more simpler seem the content tracking guide: http://developer.piwik.org/guides/content-tracking it's been a while since i've worked on the "piwik side of things" but this is reading even better to get some stats on a PW admin page: http://developer.piwik.org/guides/reporting-api-tutorial Thank you very much Teppo and Martijn for your thoughts! Very helpful answers as ever. Best regards mr-fan
  11. a other option for own admin pages with custom stuff....would be the AdminCustomPages Module https://processwire.com/talk/topic/3474-admin-custom-pages-module/ so you could assign the process AdminCustomPage and choose a "normal" PHP Template....but this not shows up the /settings/ page - this could be used for own output and dashboard like views that could be easy created without the need of a own module in the backend.... For editing /settings/ pages that are not under the /admin/ branch jlahijani's tip should do this.. @jlahijani if you got the time you could send this to the https://processwire-recipes.com/ project...it's a god home for such good hints... regards mr-fan
  12. With the PageTableExtended field you chould choose if modal should close or not on save....just to mention this here right now.... regards mr-fan
  13. Thanks Martijn - for show me my issue....just some mixed thinking...i'm sometimes a very distracted person - so i often need the right hint in the other direction Could solve this for now....an additional question. What would be a good solution to store an additional date to every count - so that hits per month or something else whould be possible...this would need a repeater? Or is there a more performant way for such simple DB tables to connect simple entry with a date - since this would grow to many entries for a reapeater at time? What could be best practise in this case. Counting views and clicks with a timestamp would only be a nice to have - but would result in nice little stats. regards mr-fan
  14. Hmm I could use a php page to handle the redirects and the click counting? Know someone a good example for such things? Or any hints on this topic? From mobile - regards mr-fan
  15. Welcome Malte to the processwire forums... there are some more topics on this with codeexamples and working options for date fields in repeater items. Have a look at: https://processwire.com/talk/topic/4933-sorting-events-by-date-with-multiple-event-dates-stored-in-repeaters/ https://processwire.com/talk/topic/2884-sorting-based-on-repeater-field-values/?p=28445 Regards mr-fan Google Search the forum is much more better than normal forum search...
  16. I'm asking since i am not that PHP pro to get my head around this. I need two things for a minimal add system with simple image banners to list a) clicks (That part should be easy since i've a part_add.php template that would be called on clicking a add ->set counter var +1 and redirect to $page->link b) views (That's the tricky part....) mixed things up....since views are the simple part on calling a template count up should be easy.....and the "click" part is that who have to solved different...but i've searched stackoverflow....and find something to play.... i thought embedding the adds via simple snippet or function to get random adds in the slots....but how i could count those views? what i've to think about the template design - ok i need a additional counter field for the views but how i get those if i simple run a find("template=part_add, limit=5,sort=random") in a foreach...is there a chance to track the views simple or need this a more complicated setup? Any hint or tipp on this would be appreciated. regards mr-fan
  17. some reading on this topic: https://processwire.com/talk/topic/3036-one-page-website-template-setup/ https://processwire.com/talk/topic/7297-one-page-websites/ https://processwire.com/talk/topic/2845-single-page-websites/ regards mr-fan Welcome to the PW forum - if you search something please use g00gle to search the forum - the forumsearch is not that good....
  18. 1) Options you could setup a reapterfield 2) Use the PageTable field type - create a page template for your quotes that only output the quote - you could use the quote pages as children where you need them - or if you have them in several places you could create a special hidden page and get them via API or in Content via HannaCode some links on this topic https://processwire.com/talk/topic/6417-processwire-profields-table/page-2#entry63119 https://processwire.com/talk/topic/8177-page-table-howto/ some example setup for PageTable or PageTableExented fields: https://processwire.com/talk/topic/7459-module-pagetableextended/ regards mr-fan
  19. have you set a start or end time for the jumplink?
  20. 1) from the module side there is pretty much in the core right now...but here are some "trending" stuff https://processwire.com/talk/topic/8298-list-your-5-must-have-modules/ 2) from your content structure you have to give your users a interface to manage easy different kind of data so maybe you are interested in the best (but commecial) module for this Lister Pro https://processwire.com/api/modules/lister-pro/ with this you can handle every task users have to interact with pages. 3) other option to handle pages and templates in a easy userinterface is a kind of "better repeater" that works with pages PageTable and PageTableExtended introducion - https://processwire.com/talk/topic/6417-processwire-profields-table/page-2#entry63119 PageTable - https://processwire.com/talk/topic/6546-pagetable-documentation/ PageTable Extended - https://processwire.com/talk/topic/7459-module-pagetableextended/ What helped me most at the beginning: Famous Kongondo's tutorial about structuring content in Processwire: https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/ Sitescraper Profile from Ryan on filtering and searching stuff via PW API: http://demo.processwire.com/ http://modules.processwire.com/modules/skyscrapers-profile/ Navigation Helper: http://modules.processwire.com/modules/markup-simple-navigation/ Helper on setup things: wireshell.pw https://processwire-recipes.com/ If you have special questions on single parts/problems you may consider before you start to create fields and templates...you could ask more specific. Best regards mr-fan
  21. So here we are now it is working....just some nesting foreach on the right place and start the output from the pagefield with the categories was the right way to go here is my easy result of my example to get the downloads in the right order of the categories.... //render pagetable pt_download if(count($page->pt_downloads)>0){ //set vars $out = ""; $cat_content = ""; $tab_content = ""; $first_cat = 0; $first_tab = 0; //all pagetable pages $downloads = $page->pt_downloads; //get used cats in the pagetable field $cats = new PageArray(); foreach ($downloads as $d) { $cats->add($d->doc_cat); } //go trow all cats and search if a cat has a download foreach ($cats as $cat) { //check for first item and count up the $first var $active = ($first_cat == 0) ? " active" : ""; $first_cat++; //output cat_content $cat_content .= '<li class="'.$active.'"><a data-toggle="tab" href="#'.$cat->name.'">'.$cat->title.'</a></li>'; //output tab_content start/header $tab_content .= '<div id="'.$cat->name.'" class="tab-pane '.$active.'"><hr class="vertical-space1">'; //get items of a cat inside the tab_content $items = $downloads->find("doc_cat=$cat"); foreach ($items as $i) { $tab_content .= '<h1>'.$i->title.' '.$i->filesize.'</h1>'; } //output tab_content end/footer $tab_content .= '</div>'; } //output cat navigation of all used cats in the pagetable field pt_downloads $content .= '<ul class="nav nav-tabs" id="myTab">'; $content .= $cat_content; $content .= '</ul>'; //output tab content with all items sorted to the right cat $content .= '<div class="tab-content" id="myTabContent">'; $content .= $tab_content; $content .= '</div>'; } this gives me a tabbed content with headings comes from the categories used in the pagetable - if files are chaning or a new category is added it should work as intended. For shure the tab_content is only testing output this will be a sortable little table in a few minutes... May the code could be better i'm not that badass PHP guy.....but i leave it here to show my solution.... Thank you Bernhard for your time and the unnecessary and embarrassing "h" so your post helped me at least, too! And to all others "don't code without enough sleep - it could be very dangerous... Best regards mr-fana added image...
  22. Ok you've got me with the "h" the rendering did not work while the pagetable pages are not working as real pages - they work as a kind of file URL example from the screenshot - item 2: a pagetable template named doc.php with the code from above works like a file link if you type or link to the page mysite/documents/testdoc.doc == the page -> the page counts the access and deliver the file under site/assets/ you could change the file from the file field but the URL and pagename would still work...this is SEO for files and i could counting access... so render them like a other pagetable - in my example code i use this on a other pagetable fieled called pt_inhalte would not work. i've to render them extra - and get the pagefields from the template (doc.php) for display the list like title with link | sum of downloads | size of the file The problem is - i have all pages that used by the pagetable - i could get all used categories - now i've to render a table with used cat and as rows the pagetable pages....under the right category. Maybe i've "Tomaten auf den Augen" But i've some ideas to try&test for tonight...so i think i can get it. for the crosslinking - soma's flexible file downloads approach https://processwire.com/talk/topic/4602-flexible-downloads-using-pages/
  23. on your questions: 1. Many -> http://processwire.com/about/sites/ 2.a) Quick -> http://directory.processwire.com/developers/ b) You'll may found faster a dev but like always in life quantity != quality 3. My personal thought is that a Main dev have to guarantee the quality of changes and build up the roadmap.....there are many contributors (not directly in the github stats but in the issue discussions and as members https://github.com/ryancramerdesign/ProcessWire/network/members ->so only question would be left who or wich group will take over if there was a vacancy of a main dev......for shure there are many talented dev's that are involved... For my thought on point 3 is - nobody can assure such things....this question is like a clients ask "You have to assure me that Wordpress has no security holes...!" regards mr-fan
  24. since i'm on dailyjob now just linking some notes/links for tonight.... didn't need ->has() selector before...this may works to get only download/file pages as items that are in my pagetable pagearray... https://processwire.com/talk/topic/10450-cross-reference-page-field-with-a-child-page/#entry98872 and get the items on every cat may i have to setup this in a function to get items per cat https://processwire.com/talk/topic/1224-selector-and-page-reference-field/#entry10841 ...maybe i found more on this in my luchtime
  25. Hi guys, maybe it's to late and i don't see the missing link....so i've to write down the problem... Setup: PageTable field - downloads templates for the PT field are: doc (contain fields like doc ->filefield, counter ->counterfield, description ->textfield, cat as a pagefield and filesize as string...) docx -"- pdf -"- this fields are all single file fields! They follow soma's approach of flexible downloads with files as pages. templates are build like this example code and so this pages works as url to the files: <?php /** * doc.php */ if($page->doc){ $page->of(false); $page->counter += 1; $page->save(array("quiet" => true)); $page->of(true); wireSendFile($page->doc->filename, $options); } this pagetable pages are all stored under /home/documents/.... so usually i render the templates from such pagetable fields without including _main.php and all is there and works like: //render pagetable pt_inhalt if(count($page->pt_inhalt)>0){ foreach($page->pt_inhalt as $l){ $content .= $l->render(); } } But with this downloads PageTable i can't render the templates since they only work for delivering the documents.... ok i've to render it different... //render pagetable pt_download if(count($page->pt_downloads)>0){ $content .= $page->pt_downloads; //gives me the pages from the pagetable like // the tree file downloads in the list 1054|1055|1061 $content .= $downloads->find("doc_cat=1060"); //gives me all files in the list with cat id = 1060 like // the two in cat "Information" 1055|1061 } So the question is how is the easiest way to render such a pagetable content as a table? and challenge is how to separet the downloads/files to the categories... - i know i've read in the forum a post about rendering pages/fields as a table but i didn't find it now to study? - i know how to search for the right categories via find() like: //get all categories from the parent page $cats = $pages->get(1057)->children("include=all"); //go trow all categories and search if a cat has a download foreach ($cats as $cat) { //find all $downloads with the doc_cat field) $found = $downloads->find("doc_cat=$cat"); //only output category if there is a download in the category if ($found != "") { //output the main cat nav as a tab interface but i don't know how to additional get the whole stuff together for the needed output in this time. Have it working with output all categories and all files but not only thoose who used in exact this pagetable content....since i need different places for filedownloads i choose this setup to have: a) a easy editor interface for adding files with pagetable field b) a central document root for all docments (would be important for further things) From the example image above it should be on frontend like: -> "Vorlagen" as group/header -> File one with title | desc | filesize | downloadlink | counter of downloads ->"Information" as group/header -> File two with title | desc | filesize | downloadlink | counter of downloads -> File tree with title | desc | filesize | downloadlink | counter of downloads may someone have a hint for me to take the right direction. Best regards mr-fan
×
×
  • Create New...