I have a wish to get my users being able to create weblink-docs and then i output them with wayfinder on a link page.
Is there a way to create the weblink docs front-end? Can I use the NewsPublisher?
I guess I will use the FDM or newspublisher and then output a field from the new document as an URL. But it had been soooo sweet
to create real modx weblink docs.
SWEEEEEEET -------------->
http://modxcms.com/forums/index.php/topic,3242.msg29835.html#msg29835
I love You MODx!!
I have to share my modified code who
zatoichi wrote:
//replace with the folder id of an unpublished folder to hold the submissions
$folder = 124;
$message = <<<MSG
<p>Submit a link to my public <a href="[~62~]">Web Links</a> page!! : )</p>
MSG;
$formTpl = <<<FRM
<form action="[~[*id*]~]" method="POST">
<input name="linkSubmitted" type="hidden" value="on" />
<table class="form" border="0" width="100%">
<tr>
<td width="200" class="formLabels"><strong>Site Name</strong>*</td>
</tr><tr>
<td><input name="pagetitle" class="form" type="text" size="35" value="$pagetitle" /></td>
</tr>
<tr>
<td width="200" class="formLabels"><strong>Menu Title</strong>* for Link Page</td>
</tr><tr>
<td><input name="menutitle" class="form" type="text" size="35" value="$menutitle" /> </td>
</tr>
<tr>
<td width="200" class="formLabels"><strong>URL</strong>*</td>
</tr><tr>
<td><input name="content" class="form" type="text" size="35" value="http://" /> </td>
</tr>
<tr>
<td width="200" class="formLabels"><strong>SHORT Description</strong></td>
</tr><tr>
<td><input class="form" size="35" type="text" name="description" value="$description" /></td>
</tr>
<tr>
<td width="200" class="formLabels"><strong>Sign ya Name here</strong></td>
</tr><tr>
<td><input name="longtitle" class="form" type="text" size="35" value="$longtitle" /> </td>
</tr>
<tr>
<td width="200" class="formLabels"></td>
<td><input type="submit" value="Submit" /> <input type="reset" value="Reset" />
</td>
</tr>
</table>
</form>
FRM;
if (!empty($_POST)) {
if(get_magic_quotes_gpc()) {
$_POST = array_map("stripslashes", $_POST);
}
$error_border = " style='border:1px solid #cc0000' ";
$style = "<span style='color:#cc0000;font-size:11px'>";
$end = "</span>";
$t = $m = $c = $errormsg = '';
$t = trim($_POST['pagetitle']);
$m = trim($_POST['menutitle']);
$c = trim($_POST['content']);
if ($t == '') {
$errormsg .= $style."*Site Name is a required field.<br>".$end;
$error_name = $error_border;
}
if ($m == '') {
$errormsg .= $style."*Menu Title is a required field.<br>".$end;
$error_name = $error_border;
}
if ($c == '') {
$errormsg .= $style."*URL is a required field.<br>".$end;
$error_url = $error_border;
$content = "http://";
}
if ($c == "http://") {
$errormsg .= $style."*URL is a required field.<br>".$end;
$error_url = $error_border;
$content = "http://";
}
if (($c != '') and ($c != "http://")) {
$get_host = parse_url($c);
$hostexist = checkdnsrr($get_host[host]);
if ($hostexist == FALSE) {
$errormsg .= $style."*The host, ".$get_host[host].", does not appear valid. Please check the URL.<br>".$end;
$error_url = $error_border;
$content = mysql_escape_string($modx->stripTags(trim($_POST['content'])));
}
}
if (!empty($errormsg)) {
$pagetitle = mysql_escape_string($modx->stripTags(trim($_POST['pagetitle'])));
$longtitle = mysql_escape_string($modx->stripTags(trim($_POST['longtitle'])));
$description = mysql_escape_string($modx->stripTags(trim($_POST['description'])));
$formTpl =<<<FRM
<form action="[~[*id*]~]" method="POST">
<input name="linkSubmitted" type="hidden" value="on" />
<table class="form" border="0" width="100%">
<tr>
<td width="200"><strong>Site Name</strong>*</td>
</tr><tr>
<td><input $error_name name="pagetitle" type="text" class="form" size="35" value="$pagetitle" /></td>
</tr>
<tr>
<td width="200" class="formLabels"><strong>Menu Title</strong>* for Link Page</td>
</tr><tr>
<td><input $error_name name="menutitle" class="form" type="text" size="35" value="$menutitle" /> </td>
</tr>
<tr>
<td width="200"><strong>URL</strong>*</td>
</tr><tr>
<td><input $error_url name="content" type="text" class="form" size="35" value="$content" /> </td>
</tr>
<tr>
<td width="200"><strong>SHORT Description</strong></td>
</tr><tr>
<td><input class="form" size="35" type="text" name="description" value="$description" /></td>
</tr>
<tr>
<td width="200"><strong>Sign ya Name here</strong></td>
</tr><tr>
<td><input name="longtitle" type="text" class="form" size="35" value="$longtitle" /> </td>
</tr>
<tr>
<td width="200" class="formLabels"></td>
<td><input type="submit" value="Submit" /> <input type="reset" value="Reset" />
</td>
</tr>
</table>
</form>
FRM;
return $message.$errormsg.$formTpl;
}
$pagetitle = mysql_escape_string($modx->stripTags(trim($_POST['pagetitle'])));
$menutitle = mysql_escape_string($modx->stripTags(trim($_POST['menutitle'])));
$content = mysql_escape_string($modx->stripTags(trim($_POST['content'])));
$longtitle = mysql_escape_string($modx->stripTags(trim($_POST['longtitle'])));
$description = mysql_escape_string($modx->stripTags(trim($_POST['description'])));
$createdon = time();
// post news content
$flds = array(
'type' => 'reference',
'pagetitle' => $pagetitle,
'menutitle' => $menutitle,
'link_attributes' => 'rel="nofollow" target="_blank"',
'longtitle' => $longtitle,
'description' => $description,
'parent' => $folder,
'createdon' => $createdon,
'published' => '1',
'deleted' => '0',
'hidemenu' => '0',
'template' => '0',
'content' => $content
);
if ($fireinthehole = $modx->db->insert($flds,$modx->getFullTableName('site_content'))) {
$message = "<p>Thank you!! : )</p>";
return $message;
}
}
if (empty($_POST)) {
return $message.$formTpl;
}
See pic!!