Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Community Answers

  1. mr-fan's post in Field Dependency based on Image Field was marked as the answer   
    Hi tom.
    bad news are here: (files&images are not supported)
    https://processwire.com/talk/topic/9841-field-dependency-on-image-field/#entry94527
    but the good news are there: (go a little indirection)
    https://processwire.com/talk/topic/9841-field-dependency-on-image-field/#entry94530
    hope this helps regads mr-fan
  2. mr-fan's post in Best Practice Creating Menus/Submenus was marked as the answer   
    A easy methode to generate Menu Markup is this nice module
    https://processwire.com/talk/topic/1036-markupsimplenavigation/
    It has many options and could generate quite every menu html strucure you need.
    And for simple API code you could take a read on the forums...the best way is to use Google on the PW site since the forum search isn't that good.
    And with this way to search the forum you can find an incredible source of reading and learning how to go further.
    (Even if the posts are from 2013 or earlier the basic will work the most times in the actual PW version too...)
    first hit on the GoogleCustomSearch:
    https://processwire.com/talk/topic/686-simple-dropdown-menu/
    https://processwire.com/talk/topic/8467-zurb-foundation-problem-with-topbar-navigation/
    https://processwire.com/talk/topic/5680-bootstrap-3-navigation-with-multiple-leveltier-fix/
    https://processwire.com/talk/topic/2819-dropdown-menu/
    https://processwire.com/talk/topic/272-multilevel-menu/
    Best regards mr-fan
  3. mr-fan's post in link to anchor in menu was marked as the answer   
    So my errors show me that i've forgot one brace and set one wrong var name...and changed the condition to check the class on current...
    so this have to work as expected.
    Have you debug mode on in config.php? Get you PHP errors?
    Here is the right example:
    // top navigation consists of homepage and its visible children $homepage = $pages->get('/'); $children = $homepage->children(); // make 'home' the first item in the navigation $children->prepend($homepage); $count_children = 0; // render an <li> for each top navigation item foreach($children as $child) {      //change the css class if child is current $class= ($child === $page->rootParent) ? " current " : ""; //count entries $count_children++; //check if we got the second/third or something else item if ($count_children == 1) {     //counting starts by 0 so second item is 1! echo custom link     echo '<li class="'.$class.'"><a href="'.$homepage->url.'#screen2">My custom title</a></li>'; } else {     //normal menu entries     echo '<li class="'.$class.'"><a href="'.$child->url.'">'.$child->title.'</a></li>';} } best regards mr-fan
  4. mr-fan's post in How to get sarted with a new site was marked as the answer   
    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
  5. mr-fan's post in PageTable - Pagefield - Special Template....headache was marked as the answer   
    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...

  6. mr-fan's post in Field width is expanded to 100% but i don't wont this...? was marked as the answer   
    Ok solved - with a simple hack and the great AdminCustomFiles modules...
    ProcessPageEdit.css
    #wrap_Inputfield_text2 {width: 34%!important;} is there a reason why the data-original-width is overwritten with a inline style attribute with "filling" the width to 100%?
    regards mr-fan
  7. mr-fan's post in Repeater Image not showing was marked as the answer   
    ok found the missing thing...deeper look in your html shows:
    <a href="#"> <img src="unfallservice.png"> </a> so the imagename is there....not the path/url...so it was wrong example from me...since i load the image always in a var like:
    //get the first image from the array of the repeater field $myimage = $col->images->first(); and then use it like:
    //use the $myimage var to call all needed things like url, name, description... <a href="#"> <img src="<?php echo $myimage->url; ?>" alt="<?php echo $myimage->description; ?>" /> </a> you can set the size, too with this API calls have a good read here:
    https://processwire.com/api/fieldtypes/images/
    there is my example, too
    for a fast look you could quick change:
    <a href="#"> <img src="<?php echo $col->images->first(); ?>" /> </a> //to <a href="#"> <img src="<?php echo $col->images->first()->url; ?>" /> </a> best regards mr-fan
  8. mr-fan's post in pre process template image sizes was marked as the answer   
    Or use
    http://modules.processwire.com/modules/fieldtype-crop-image/
    or
    https://github.com/horst-n/CroppableImage
    to generate the pre-generate the needed thumbnail sizes and call them directly int the template like
    // get the first image instance of crop setting 'portrait' $image = $page->images->first()->getCrop('portrait'); regards mr-fan
  9. mr-fan's post in Thread messaging system was marked as the answer   
    there are two main concepts...
    all are pages == models, objects and so on
    fields are your data
    with a pagefield you could combine all together an get your 1:n n:1 1:1 connection of your models...
    have a read:  http://processwire.com/videos/page-fieldtype/
    next hint:
    you have 3 models like LostKobrakai wrote:
    messages (messagetext, pagefield for the thread, pagefield for the user_profile)
    --m1
    --m2
    --m3
    threads (simple pagefield for the connection to the messages of one thread)
    -t1
    -t2
    -t3
    -user_profiles (would make this maybe separate from the existing usersystem - depends on the other things on this site/app)
    -u1 (refer to the $user and pagefield with saves all his messages)
    -u2
    there is a module that helps you to get information about the pagefield relations:
    http://modules.processwire.com/modules/page-references-tab/
    if all is configured right you could use the PW API to get your data and save your data right how do you like.
    For Frontend or Bakendusage (there is a module for custom admin pages).
    best regards mr-fan
×
×
  • Create New...