Jump to content

Change field name


JBJ
 Share

Recommended Posts

Just download processwire and the skycraper template.

Changed the "floor" field name to "floors", then went to the template skyscraper-list-item.php and change:

<div class='uk-width-1-3 uk-width-small-1-5'>
                    <?=$floors?><br />
                    <small class='uk-text-muted'>floors</small>
                </div>

to

<div class='uk-width-1-3 uk-width-small-1-5'>
                    <?=$floorss?><br />
                    <small class='uk-text-muted'>floors</small>
                </div>


Now all skycraper have "floor" as empty value. What I'm missing? ?

Thanks!

floors.PNG

Link to comment
Share on other sites

That $floors is just a variable set from the php file which actually includes the skyscraper-list-item.php. You'll have to modify the php file actually including this one (may be included multiple times). You may start looking in function  renderSkyscraperListItem located in _func.php:

	// send to our view file in includes/skyscraper-list-item.php
	$out = files()->render('./includes/skyscraper-list-item.php', array(
		'skyscraper' => $skyscraper,
		'url' => $skyscraper->url,
		'img' => $img, 
		'title' => $skyscraper->title, 
		'city' => $skyscraper->parent->get("title"),
		'height' => $skyscraper->get('height|unknown'),
		'floors' => $skyscraper->get('floors|unknown'),
		'year' => $skyscraper->get('year|unknown'),
		'summary' => summarizeText($skyscraper->get('body'), 500)
	));

...and, of course, welcome to the forum!

  • Like 2
Link to comment
Share on other sites

14 hours ago, Autofahrn said:

That $floors is just a variable set from the php file which actually includes the skyscraper-list-item.php. You'll have to modify the php file actually including this one (may be included multiple times). You may start looking in function  renderSkyscraperListItem located in _func.php:


	// send to our view file in includes/skyscraper-list-item.php
	$out = files()->render('./includes/skyscraper-list-item.php', array(
		'skyscraper' => $skyscraper,
		'url' => $skyscraper->url,
		'img' => $img, 
		'title' => $skyscraper->title, 
		'city' => $skyscraper->parent->get("title"),
		'height' => $skyscraper->get('height|unknown'),
		'floors' => $skyscraper->get('floors|unknown'),
		'year' => $skyscraper->get('year|unknown'),
		'summary' => summarizeText($skyscraper->get('body'), 500)
	));

...and, of course, welcome to the forum!

Thanks! Finally figure out how to do it ?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...