Jump to content

My items in the field field on the MAIN template, have disappeared on the front end (they still exist on the back end)


Recommended Posts

Hello, several years ago I had moved the _main file from its original location. Now I have put it back where it belongs, and as a result processwire asks me with each template created whether to include the _init and _main files.
That's fine. This is the only thing I have done again in the last few weeks with the _main file.
Now, however, the "main" file seems to have broken.
It seems to have broken the BODY field, the one that contains the article text.
ALL MY ARTICLES ARE GONE. THEY ARE NOT VISIBLE ONLINE. THE TEMPLATE APPEARS, BUT NOT THE ACTUAL TEXT.
I thought they had been deleted.
Then I went to look in the internal panel of each article processwire, with the "edit" button.
There the article is still written there, inside the "body" field, but it does NOT COMPARE ONLINE, IN THE FRONT END. IT STILL EXISTS IN THE BACK END. Could someone suggest how to solve it?
I created a new text field, and while copying in the old articles, the new text fields do not work either. But they work in other templates. The text field no longer works in the MAIN template.
Can anyone help me?

Link to comment
Share on other sites

Hello,

You should paste in here the exact code of your _main.php, preferably hidden in a spoiler block of this editor (use both the "eye" and the "code" icons of the toolbar). That way we can have a better understanding of the issue and ask further questions.

Link to comment
Share on other sites

1 hour ago, szabesz said:

Hello,

You should paste in here the exact code of your _main.php, preferably hidden in a spoiler block of this editor (use both the "eye" and the "code" icons of the toolbar). That way we can have a better understanding of the issue and ask further questions.

Ok, the php code of "_main.php" file is this:
 

<?php namespace ProcessWire;

/**
 * _main.php
 * Main markup file
 *
 * This file contains all the main markup for the site and outputs the regions 
 * defined in the initialization (_init.php) file. These regions include: 
 * 
 *   $title: The page title/headline 
 *   $content: The markup that appears in the main content/body copy column
 *   $sidebar: The markup that appears in the sidebar column
 * 
 * Of course, you can add as many regions as you like, or choose not to use
 * them at all! This _init.php > [template].php > _main.php scheme is just
 * the methodology we chose to use in this particular site profile, and as you
 * dig deeper, you'll find many others ways to do the same thing. 
 * 
 * This file is automatically appended to all template files as a result of 
 * $config->appendTemplateFile = '_main.php'; in /site/config.php. 
 *
 * In any given template file, if you do not want this main markup file 
 * included, go in your admin to Setup > Templates > [some-template] > and 
 * click on the "Files" tab. Check the box to "Disable automatic append of
 * file _main.php". You would do this if you wanted to echo markup directly 
 * from your template file or if you were using a template file for some other
 * kind of output like an RSS feed or sitemap.xml, for example. 
 *
 * See the README.txt file for more information. 
 *
 */
?><!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<title><?php echo $title; ?></title>
	<meta name="description" content="<?php echo $page->summary; ?>" />
	<link href='//fonts.googleapis.com/css?family=Lusitana:400,700|Quattrocento:400,700' rel='stylesheet' type='text/css' />
	<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" />
</head>
<body class="<?php if($sidebar) echo "has-sidebar "; ?>">

	<a href="#main" class="visually-hidden element-focusable bypass-to-main">Skip to content</a>

	<!-- top navigation -->
	<ul class='topnav' role='navigation'>
	<?php
		// top navigation consists of homepage and its visible children
		foreach($homepage->and($homepage->children) as $item) {
			if($item->id == $page->rootParent->id) {
				echo "<li class='current' aria-current='true'><span class='visually-hidden'>Current page: </span>";
			} else {
				echo "<li>";
			}
			echo "<a href='$item->url'>$item->title</a></li>";
		}

		// output an "Edit" link if this page happens to be editable by the current user
		if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>Edit</a></li>";
	?>
	</ul>

	<!-- search form-->
	<form class='search' action='<?php echo $pages->get('template=search')->url; ?>' method='get'>
		<label for='search' class='visually-hidden'>Search:</label>
		<input type='text' name='q' placeholder='Search' id='search' value='<?php echo $sanitizer->entities($input->whitelist('q')); ?>' />
		<button type='submit' name='submit' class='visually-hidden'>Search</button>
	</form>

	<!-- breadcrumbs -->
	<div class='breadcrumbs' role='navigation' aria-label='You are here:'><?php
		// breadcrumbs are the current page's parents
		foreach($page->parents() as $item) {
			echo "<span><a href='$item->url'>$item->title</a></span> "; 
		}
		// optionally output the current page as the last item
		echo "<span>$page->title</span> "; 
	?></div>

	<div id='main'>

		<!-- main content -->
		<div id='content'>
			<h1><?php echo $title; ?></h1>
			<?php echo $content; ?>
		</div>

		<!-- sidebar content -->
		<?php if($sidebar): ?>
		<aside id='sidebar'>
			<?php echo $sidebar; ?>
		</aside>
		<?php endif; ?>

	</div>

	<!-- footer -->
	<footer id='footer'>
		<p>
		Powered by <a href='http://processwire.com'>ProcessWire CMS</a>  &nbsp; / &nbsp; 
		<?php 
		if($user->isLoggedin()) {
			// if user is logged in, show a logout link
			echo "<a href='{$config->urls->admin}login/logout/'>Logout ($user->name)</a>";
		} else {
			// if user not logged in, show a login link
			echo "<a href='{$config->urls->admin}'>Admin Login</a>";
		}
		?>
		</p>
	</footer>

</body>
</html>

 

Then, the "main.php" code is this:

 

<?php namespace ProcessWire;

/**
 * _main.php
 * Main markup file
 *
 * This file contains all the main markup for the site and outputs the regions 
 * defined in the initialization (_init.php) file. These regions include: 
 * 
 *   $title: The page title/headline 
 *   $content: The markup that appears in the main content/body copy column
 *   $sidebar: The markup that appears in the sidebar column
 * 
 * Of course, you can add as many regions as you like, or choose not to use
 * them at all! This _init.php > [template].php > _main.php scheme is just
 * the methodology we chose to use in this particular site profile, and as you
 * dig deeper, you'll find many others ways to do the same thing. 
 * 
 * This file is automatically appended to all template files as a result of 
 * $config->appendTemplateFile = '_main.php'; in /site/config.php. 
 *
 * In any given template file, if you do not want this main markup file 
 * included, go in your admin to Setup > Templates > [some-template] > and 
 * click on the "Files" tab. Check the box to "Disable automatic append of
 * file _main.php". You would do this if you wanted to echo markup directly 
 * from your template file or if you were using a template file for some other
 * kind of output like an RSS feed or sitemap.xml, for example. 
 *
 * See the README.txt file for more information. 
 *
 */
?><!DOCTYPE html>
<html lang="it">

<head>
	
	
	<title><?php echo $page->title;?></title>
	<link rel="icon" href="<?php echo $config->urls->templates?>favicon/po-extra.png" type="image/png">	
	
	<?php wireIncludeFile('styles/metatag.php'); ?>	


	<!-- STILE MAIN -->

		<!-- <php include('styles/po-menu-primo.php'); ?>	-->
	
		<?php wireIncludeFile('styles/head-main.php'); ?>	
	

	<!-- END -->



</head>



<body class="<?php if($sidebar) echo "has-sidebar "; ?>">





	<!-- INTRO PERMA -->

	<div style="border-radius: 15px; border: 2px solid #111; padding: 5px 25px 5px; background-image: linear-gradient(to right, rgb(101, 115, 255), rgb(113, 133, 225), rgb(125, 152, 195), rgb(137, 170, 166), rgb(149, 189, 136), rgb(161, 207, 106), rgb(134, 173, 88), rgb(107, 138, 71), rgb(81, 104, 53), rgb(54, 69, 35), rgb(27, 35, 18), rgb(0, 0, 0));">
	

		<p style="text-align: justify; font-family: 'Source Sans Pro', sans-serif; font-size: 14px; font-weight: 600;  line-height:1.1em; color: white;">

			La permacultura esiste perché esiste la natura. La natura presuppone l'esistenza di due parti con interessi contrapposti: il cavolo e la capra, l'ecosistema naturale e la cittá. Alcune ecosofie vorrebbero cancellare o ignorare questa opposizione fondamentale.
			<br>Per contribuire a una interpretazione più approfondita della permacultura, è stato aperto questo sito, ispirato all'ignoto pensiero di Paperinik: <span style="color: yellow;"><i>&laquo;è interessante notare come una vera e felice autosufficienza di molti ecovillaggi in rete, vista dalla cittá somigli più a una disgrazia per la città e per l'economia tutta&raquo;.</i></span> Una verità scioccante ma dalle conseguenze numerose e visibili a tutti...
        
		</p>
		
		<div style="padding-bottom: 10px;">
											
			<a href="https://pot.permaculturaorganica.info/registrazione">
				<div class="btn-simple2">Iscrizione al P.O.T. &#x27A4 </div>			
			</a>
		
		</div>	
		
    </div>
	
	<div style="display: block; text-align: center; padding-top: 20px;">
		<a href="https://buonacausa.org/cause/regina-sole-terra">
			<span style="font-family: Quattrocento;">
				PO Project <i>"Regina del Sole"</i>
			</span>	
		</a>			
	</div>	
	
	<div style="display: block; text-align: center; padding-top: 00px;">
		<a href="https://permaculturaorganica.info/crowdfunding">
			<span style="font-family: Oswald; letter-spacing: 1px;">
				<b>PROGETTI DEGLI ISCRITTI</b>
			</span>	
		</a>			
	</div>		
	
			
	<div style="padding-top: 15px; display: block; text-align: center;">
		
		<?php 
			
			if($user->isLoggedin()) {
			
			// if user is logged in, show a logout link
			echo "<a href='{$config->urls->admin}login/logout/'>Esci($user->name)</a>";
			
			} else {
			
			// if user not logged in, show a login link
			echo "<a href='{$config->urls->admin}'>------</a>";
			
			}
			
		?>
					
	</div>				
			
	
	</div>
	</div>
	
    <!--END-->







	<a href="#main" class="visually-hidden element-focusable bypass-to-main">Skip to content</a>





	<!-- top navigation -->
	<ul style="margin-top: 30px;" class='topnav' role='navigation'>
	<?php

		// output an "Edit" link if this page happens to be editable by the current user
		if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>Scrivi</a></li>";
	?>
	</ul>


	<!-- breadcrumbs -->

	<div style="font-family: Abel;" class='breadcrumbs' role='navigation' aria-label='You are here:'>
	
		<div style="font-family: Lobster; font-size: 2em; color: #98af00;">Il Filo Verde...</div> 
				
		<div class="ilfiloverde">
		
			<?php
			
				// breadcrumbs are the current page's parents
				foreach($page->parents() as $item) 
				
				{
					echo "<span><a href='$item->url'>$item->title</a></span> "; 
				}
			
				// optionally output the current page as the last item
				echo "<span>$page->title</span> "; 
				
			?>
		
		</div>
	
	</div>
	
	
	

	<div id='main'>

		<!-- main content -->
		<div style="padding-bottom: 30px;" id='content'>
		
			<h1 style="text-align: center; line-height: 1em; color: green;"><?php echo $title;?></h1>

			<p style="text-align: center; font-family: Indie Flower; font-size: 1.3em; line-height:1.3em; color: grey;">

				<?=$page->tag155?>
			
			</p>

			<div class="bat animated rollIn wow">
				<a style="text-decoration: none;" href="https://permaculturaorganica.info/bat">
					<img src="<?php echo $config->urls->templates?>styles/assets/img/bat.png" alt="basic atttention token">
				</a>
			</div>
				
			<p>di <a href="https://permaculturaorganica.info/about-me"><strong><span style="font-family: Caveat;">A. Francesco Papa</span></strong></a></p>		

		</div>
		
		
		<?php echo $content; ?>
		
		
		
		<!-- sidebar content -->
		<?php if($sidebar): ?>
		<aside style="font-family: Abel;" id='sidebar'>
			<?php echo $sidebar; ?>
		</aside>
		<?php endif; ?>
		

	</div>

	<!-- footer -->
	<footer id='footer'>
	

		<div id="a-nogrey" style="border-radius: 15px; border: 2px solid #111; padding: 5px 25px 5px; background-image: linear-gradient(to right, rgb(101, 115, 255), rgb(113, 133, 225), rgb(125, 152, 195), rgb(137, 170, 166), rgb(149, 189, 136), rgb(161, 207, 106), rgb(134, 173, 88), rgb(107, 138, 71), rgb(81, 104, 53), rgb(54, 69, 35), rgb(27, 35, 18), rgb(0, 0, 0));">
	
			<p style="text-align: justify; font-family: 'Source Sans Pro', sans-serif; font-size: 14px; line-height:1.1em; padding-bottom: 10px;">

				<span style="color: yellow;">
				
					<b>
					
						Hai qualcosa da dire o un sapere speciale da diffondere, ma non hai la voglia o la capacità di gestire un sito web?
						
					</b>
					
				</span>
					
				<br>
				
				<span style="color: lightpink;">
				
					<b>
					
						Pubblicando online darai esistenza visibile alle idee che potrebbero morire con te!
					
					</b>
				
				</span>
				
				<br>
				
				<span style="color: white;">
				
					<b>
					
						Promuovi il tuo progetto di permacultura e/o i riferimenti del tuo commercio organico, anche attraverso sito. Auguri!</b>
				
					</b>
				
				
				</span>				
				
				
				
				<br><br>
				
				<span style="color: white;">
				
					<i>Servizio offerto gratuitamente ma ad</i> <a href="https://permaculturaorganica.info/rds"><b>ALCUNE CONDIZIONI</b>.</a>
					<br>
					<i>Appunta il</i> <b>CODICE RdS</b> <i>che, fra i 4 proposti, meglio rappresenta la tua ETICA COMMERCIALE, poi torna qui e compila il form di pubblicazione.</i>
					
				</span>
			
			</p>
			
			<div style="padding-bottom: 10px;">
											
				<a href="https://permaculturaorganica.info/moduli-contatto/pubblica-articolo">
					<div class="btn-simple2">PUBBLICA UN ARTICOLO &#x27A4 </div>			
				</a>
				
				<a href="https://permaculturaorganica.info/home">
					<div style="text-align: center;">Torna al PO PANNEL</div>		
				</a>
			
			</div>
			
				
			
	
		</div>		
		
		
		
		
		
		
		<div style="padding: 10%; color: green; font-family: Indie Flower; font-size: 2em; text-align: center;">
			<b>CIAO, TI VA QUESTA SETTIMANA DI FARE UNA SPESA SOLIDALE?
			<br><br>
			<a href='http://permaculturaorganica.info/wosp/spesa/francesco-papa'>CLICCA QUI</a>
		</div> 

				
		<div style="padding-bottom: 25px;">
		
			<span style="font-family: Lobster; font-size: 2em; color: green;">Corsi Online</span> 
		
			<span style="font-family: Abel; font-size: 1.3em; font-weight: 700;">			
			
				<br>&starf; Permacultura Liv.1 - <i>Durata: 2 ore 15 min </i>&xrArr; <a href='https://permaculturaorganica.info/po1-leggere/corsi-online'><span style="font-family: Rajdhani; letter-spacing: 3px;">SEGUI</span></a>
				<br>&star; Permacultura Liv.2 - <i>Work in Progress </i>
				<br>&star; Permacultura Liv.3 - <i>Work in Progress </i>
				<br>&star; Permacultura Liv.4 - <i>Work in Progress </i>
				<br>&star; Permacultura Liv.5 - <i>Work in Progress </i>
				<br>&star; Permacultura Liv.6 - <i>Work in Progress </i>
				<br>&star; Permacultura Liv.7 - <i>Work in Progress </i>

			</span>
			
		</div>				
				
				
		<div style="padding-bottom: 25px;">
		
			<span style="font-family: Lobster; font-size: 2em; color: purple;">Libri</span> 
		
			<span style="font-family: Times New Roman; font-size: 1.3em; font-weight: 700;">			
			
				<br>&starf; <i>Permacultura Sociale & Gruppi di Mutuo-Aiuto</i> &xrArr; <a href='https://www.amazon.it/dp/1072149540'><span style="font-family: Rajdhani; letter-spacing: 3px;">VEDI</span></a>
				<br>&starf; <i>Totalitaristi Mascherati</i> &xrArr; <a href='https://www.amazon.it/dp/B09R3HR8BG'><span style="font-family: Rajdhani; letter-spacing: 3px;">VEDI</span></a>
				<br>&star; <i>Permacultura per Pochi - Work in Progress</i>


			</span>
			
		</div>
		
		
		
		
		<div style="padding-bottom: 25px;">
		
			<span style="font-family: Lobster; font-size: 2em; color: red;">Canali Telegram</span> 
		
			<span style="font-family: Oswald; font-size: 1.3em;">
			
				<br>
				&#9658 GESU' RE D'ITALIA &xrArr; <a href='http://t.me/gesureditalia'><span style="font-family: Rajdhani; letter-spacing: 3px;">ISCRIVITI</span></a>		
				<br>
				&#9658 PERMACULTURA &xrArr; <a href='http://t.me/permaculturaORGANICA'><span style="font-family: Rajdhani; letter-spacing: 3px;">ISCRIVITI</span></a>
				<br>
				&#9658 SBN - SOLO BUONE NOTIZIE &xrArr; <a href='http://t.me/solobuonenotizie'><span style="font-family: Rajdhani; letter-spacing: 3px;">ISCRIVITI</span></a> 
				<br>
				&#9658 METEORE PARLANTI (miscellanea di argomenti) &xrArr; <a href='http://t.me/meteoreparlanti'><span style="font-family: Rajdhani; letter-spacing: 3px;">ISCRIVITI</span></a> 


				<br><br>
				
				<a href="https://permaculturaorganica.info/po1-leggere/rami/politica-organica/astensionista-capriccioso/">
				
				
				<div style="font-family: Caladea; font-size: 1em; text-align: center; padding-left: 15%; padding-right: 15%; padding-bottom: 20px;">
					
					&malt;
					<br>
					<i>
						Il voto è un gioco. Non sei purtroppo il Re nè la Regina, ma puoi muovere la tua pedina!
					</i>
					<br>
					&malt;
					
				</div>
				
				
				
				
				</a>

			</span>
			
		</div>
		
		
		
		
		<div style="padding-bottom: 50px; text-align: center;">		

			<span style="color: #b30000; font-family: Oswald; font-size: 2em;">NO CENSURE NO TRACCIAMENTI<br>NO PUBBLICITA' SU TELEGRAM<br><a href='https://permaculturaorganica.info/social/canali-telegram-consigliati'>CLICCA QUI</a></span>

			<br><br>
			
			<span style="font-family: Times; font-size: 1.5em;"><i>Il Dubbio non è Il Male, la <span style="text-decoration: underline;">Libertà di Argomentare</span> è Sacra e Tu sei un uomo come Me!</i></span>		

			<br><br>

			<img src="<?php echo $config->urls->templates?>styles/assets/img/maestrini/ragazza-confusa2.png" alt="ovvio">

		</div>



		

		
	    <!-- ADERISCI ECONOMICAMENTE ALLA PO CAUSA -->
	
		<div  class="mfire3">
	
			<a target="_blank" href="https://www.paypal.com/donate/?hosted_button_id=HZ9J3H5W3YZ2S">
				<div class="text-aepc">VOGLIO FINANZIARE<br>LE PO MISSIONI &#x27A4 </div>			
			</a>	
	
		</div>	
	
    <!--END -->	














	
	
	
	


		
		
	</footer>

</body>
</html>

 

"main.php" without "_main.php" works well

 

 

Link to comment
Share on other sites

In your first post of this topic, you mention the "body" field. Unfortunately I don't see that field being represented in either of the above template files. I'm not entirely sure here why you'd use both (if you're using both) the _main.php and main.php files - it seems like your main.php file was created based on the _main.php; using them both simultaneously wouldn't make sense.

Within both of the above templates, there is a referenced "content" field, but not a "body" field. Do you have a "content" field? If not, try changing the variable name in the appropriate template(s) from "content" to "body" to match the associated backend template field name(s).

Does that make sense?

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

×
×
  • Create New...