Jump to content

Leaderboard

  1. Morrigan

    Morrigan

    Admin


    • Points

      1

    • Posts

      27,267


Popular Content

Showing content with the highest reputation on 03/31/2022 in all areas

  1. So the Character Mod will likely hold all of your character's information. It's a matter of pulling that information out and being able to utilize it elsewhere to make lists. Below is the code for a Playbys list however can work for other things. With the new version of the Character Mod it is not required to do this for groups as the Character List allows you to filter by groups now. So first things first, you need to create your custom field for the plaby/faceclaim that your users will be able to edit and add their plaby into. If you already have this then skip to the next step. To do this you need to go to Community > Characters > Custom Fields > Create New > Create a Text Field. Whether you show it in the posts or profile or not is irrelevant. In our example below the key we use is "playby" so you need to use this or make sure to change it in the code. Once you have this created you need the field ID. To find this you can mouse over the field, by going to the edit page and looking at the URL or copy and pasting the URL into your favorite editor. That ID is what you'll replace the # with in the below code into an HTML block in Pages (Pages > Blocks > Create New > Custom HTML): <div class='ipsPad'> <h2 class="ipsType_sectionTitle ipsType_reset cForumTitle">Playby List</h2> <div class="ipsPad ipsBox"> {{$runit = \IPS\Db::i()->select('*', 'characters_fields_values', 'field_# != ""', 'field_# ASC');}} <ul class='ipsDataList ipsDataList_reducedSpacing playbyList ipsGrid ipsGrid_collapsePhone' data-ipsgrid data-ipsgrid-equalheights="row"> {{foreach $runit as $playbys}} {{$char = \IPS\characters\Character::load( $playbys[character_id]);}} {{if $char->approved == 1}} <li class="ipsPhotoPanel ipsPhotoPanel_small ipsAreaBackground_reset ipsClearfix ipsGrid_span4 ipsPad"> <span class="ipsUserPhoto ipsUserPhoto_small ipsPos_top"> {{if $char->photo}} <img src="{file="$char->photo"}" alt="$char->name" /> {{else}} <img src='{resource="default_photo.png" app="core" location="global"}' alt="$char->name"> {{endif}} </span> <div class=""> <strong>Playby:</strong> {$char->fields('playby')} <br /><strong>Character:</strong> {template="link" app="characters" location="front" group="character" params="$char"} <br /><strong>Played by:</strong> {$char->owner()->link()|raw} </div> </li> {{endif}} {{endforeach}} </ul> </div> </div> This code will give you a simple list with an image to the side, the playby, the character and the player that plays the character. It is in a grid view and you can edit as necessary but it's in alphabetical order by first name of the playby. To explain the code a little we first tell the code to find all characters that have a playby filled in so the field is "not blank". Then we loop through those (where the foreach starts) to show them. To get the character name and player name we first load the character then check to be sure they are approved, because we only want approved characters showing in our lists, and then we output how we want everything to look. You're free to ask questions in the IPS Staff People Coterie or get assistance. Please feel free to leave a review below.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.