Fork me on GitHub

Pagesetter: Editing Publications  Bottom

Go to page [-1] 1 - 2:

  • Ok, I have played around with making a custom edit template. I can get the text and textarea fields to work (because of the example template provided with pgForm), but I cannot seem to get other field types to work (images, lists, etc.). I believe that I just don't understand the syntax to be used with the various tags. I tried using the code in the main modify template, but that doesn't work either. Is there any chance we could get examples of the various field types in the example template?

    Here is what I've tried to do with an image field. It shows the file upload box but does not recognize the existing image.

    Code

    <!-- image upload -->
        <p>
          <label for="field-image-set">Image:</label>
          <!--[if $pub.$image-set]-->
            <input type="hidden" id="field-image-set" name="pubfields[image-set]" value="<!--[$pub.$image.name|pnvarprepfordisplay]-->" />
            current image is <a href="<!--[pnmodurl modname='pagesetter' type='file' func='get' tid=$pub.core_tid fid=$fieldname id=$pub.core_id]-->" target="_blank"><!--[$pub.$image|pnvarprepfordisplay]--></a> (<!--[$pub.$fieldname.size]--> bytes)
            <!--[if $isMandatory]-->
              Replace image with <input type="file" class="formborder" id="field-image" name="pubfields[image]" size="40" maxlength="255" />
            <!--[else]-->
              <input type="checkbox" class="formborder" id="field-image-del" name="pubfields[image-del]" onclick="document.getElementById('field-image').disabled = this.checked;" /> Delete existing image, or
              Replace image with <input type="file" class="formborder" id="field-image" name="pubfields[image]" size="40" maxlength="255" />
            <!--[/if]-->
          <!--[else]-->
            <input type="file" class="formborder" id="field-image" name="pubfields[image]" size="40" maxlength="255" />
          <!--[/if]-->
        </p>

    Here is what I tried to use for a list. The dropdown box shows up, but there are no option items inside.

    Code

    <!-- tag1 -->
        <p>
          <label for="field-tag1">Tag 1:</label><br />
          <select class="required" name="pubfields[tag1]" id="field-tag1">
            <!--[foreach from=$pubtype.fields[field].listInfo.items item=listitem]-->
              <option value="<!--[$listitem.id]-->" <!--[if $pub.$fieldname == $listitem.id]-->selected="selected"<!--[/if]-->>
                <!--[php]-->for ($i = 0; $i < $this->_tpl_vars[listitem][indent]; $i++) echo('-');<!--[/php]-->
                <!--[$listitem.title|pnvarprepfordisplay]-->
              </option>
            <!--[/foreach]-->
          </select>
        </p>




    edited by: Wendell, Apr 30, 2009 - 10:46 PM
  • Sorry for the late reply, was very busy on another project. I'll try to create some more examples. Haven't tested but on the image my first reaction would be to do something like this:

    Code

    <!-- image upload -->
    <!--[if $pub.myimage.name]-->
      <input type="hidden" id="field-myimage-set" name="pubfields[myimage]" value="<!--[$pub.myimage|pnvarprepfordisplay]-->" />
      current image is <a href="<!--[pnmodurl modname='pagesetter' type='file' func='get' tid=$pub.core_tid fid=myimage id=$pub.core_id]-->" target="_blank"><!--[$pub.myimage|pnvarprepfordisplay]--></a>&nbsp;(<!--[$pub.myimage.size]-->&nbsp;bytes)<br />
      <!--[if $isMandatory]-->
        Replace image with <input type="file" class="formborder" id="field-myimage" name="pubfields[myimage]" size="40" maxlength="255" />
      <!--[else]-->
        <input type="checkbox" class="formborder" id="field-myimage-del" name="pubfields[myimage-del]" onclick="document.getElementById('field-myimage').disabled = this.checked;" />&nbsp;Delete existing image, or<br />
        Replace image with <input type="file" class="formborder" id="field-myimage" name="pubfields[myimage]" size="40" maxlength="255" />
      <!--[/if]-->
    <!--[else]-->
      <input type="file" class="formborder <!--[if $isMandatory]-->required<!--[/if]-->" id="field-myimage" name="pubfields[myimage]" size="40" maxlength="255" />
    <!--[/if]-->


    Again: not tested!
  • Any idea on how to setup a select in pgForm? In the Pagesetter pubtype, it is associated with a Pagesetter category. I have tried several combinations and I can't get any of them to work.
  • Wendell

    Any idea on how to setup a select in pgForm? In the Pagesetter pubtype, it is associated with a Pagesetter category. I have tried several combinations and I can't get any of them to work.


    Hi Wendell,

    I tried to answer your post here http://code.zikula.o…FormCustomtemplates. Hope it helps.
  • Brilliant. Thanks again for all your hard work. icon_biggrin

    Update: I just tried it out and it works a treat. Also, pgForm has officially been upgraded to my #1 favorite module of all time, with Pagesetter at #2 being considered as a supporting module to pgForm. icon_wink Apologies to Jorn. icon_wink



    edited by: Wendell, Jun 09, 2009 - 09:13 AM
  • Quote

    Haven't tested but on the image

    It works great except for one little detail. Instead of

    Code

    <!--[$pub.myimage|pnvarprepfordisplay]-->
    it should be

    Code

    <!--[$pub.myimage.name|pnvarprepfordisplay]-->
  • Another question arises that is beyond my capabilities -- how would you use a foreach type statement to show all the images? For instance, if I have PS fields for image1, image2, etc. and want to show those fields in the pgForm template but without listing each one individually.

    I'm working on a template right now with 20 image fields so you can imagine how big the template has become when not using a foreach. Maybe I just have to live with that. icon_wink



    edited by: Wendell, Aug 14, 2009 - 02:13 PM
  • Wendell

    Another question arises that is beyond my capabilities -- how would you use a foreach type statement to show all the images? For instance, if I have PS fields for image1, image2, etc. and want to show those fields in the pgForm template but without listing each one individually.


    I see what you would like to do, but since the fields are not structured in Pagesetter I wouldn't know how to loop through them in pgForm. Alternatively what you can do is create a template containing all the markup for an image and include that template from your main template. You could pass all required variables to the included template. Something like this:

    Code

    <!--[include file="pgForm_user_new_myimage.htm" fieldname=$fieldname parameter2="parameter2value"]-->




    edited by: dits, Aug 15, 2009 - 01:11 PM

Go to page [-1] 1 - 2:

This list is based on users active over the last 60 minutes.