Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Tag txp:php
Textpattern a powerful CMS system with many tools.
My question is what can you build or how much can you write within textpattern using txp:php tag? Because I was trying to write a simple login page I was getting errors.
Thank you for your input.
Offline
Re: Tag txp:php
Hey code365 – what is the code you’re using and what errors are displayed?
Offline
Re: Tag txp:php
Gawked thank you for your reply.
I deleted the code, decided to write raw php code outside Textpattern. I would like to try to keep as much txp:php code within TextPattern. But can you build a login screen…etc within Textpattern calling a data?
Thank you
Offline
Re: Tag txp:php
I can’t help you with the PHP code, I’m afraid – do you want to have users self-register and use your Textpattern site, or something else?
Offline
Re: Tag txp:php
Yeah, that is the ideal for users self-register. Also I understand you can’t help with code part. But any input of what can txp:php allow you to do.
Last edited by code365 (2014-11-07 19:53:09)
Offline
Re: Tag txp:php
Take a look at mem_self_register – I haven’t used it, and I can’t say if it will work with the latest Textpattern, but it seems to do what you want.
Offline
Re: Tag txp:php
Thank you for your help but it do not work with the new TXP.
Last edited by code365 (2014-11-07 21:39:18)
Offline
#8 2014-11-07 22:23:08
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Tag txp:php
Here’s a short roundup on working with txp:php.
code365 wrote #285570:
[…] but it do not work with the new TXP.
Please read gaekwad’s post again :) Ah sorry, me too quicky ;)
Last edited by uli (2014-11-07 22:24:40)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Tag txp:php
The latest version of mem_self_register does work, though it can be fiddly to set up. There are alternatives such as cbe_frontauth and mck_login. Or if you want to roll your own you can combine plugins like rvm_privileged, or mem_form with mem_public_article or smd_query or etc_query.
Regarding what you can and can’t do in <txp:php>
, pretty much anything you can do in PHP you can do in those blocks. Two caveats:
- Anything you want to share across blocks or use from Textpattern (its globals for example) need to be imported/exported in your code’s scope using the
global
keyword. - Textpattern tags aren’t parsed. You need to use
parse('<txp:some_tag attribute="value" ... />')
; - You can’t open conditionals in one block and complete them in another (like you can with raw
<?php..?>
). Each block has to be a complete, valid, self-contained lump of PHP.
Other than that, anything goes. So if you’re getting errors, throw some code here and we’ll see if we can get you on the right track.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: Tag txp:php
Hi, i am writing here, instead of opening a new thread.
When I try to write the following code
<txp:php> include('csvtoservice.php'); $content = csvtoservice('http://winterolympicsmedals.com/medals.csv'); // if it could be loaded and parsed... if($content){ // show the form echo '<h2>Filtri</h2>'; if($content['form']){ echo $content['form']; } // show the table if($content['table']){ echo '<h2>Risultati</h2>'; echo $content['table']; } } </txp:php>
I get this error
Notice: Undefined offset: 8192 in /Applications/MAMP/htdocs/saba/textpattern/lib/txplib_misc.php on line 680 Tag error: <txp:php> -> : Function split() is deprecated while parsing form None on page ricerca
csv to webservice is a PHP script to pull data from a CSV file on the web and turn it into a search and filter interface. Here is just a snippet of csvtoservice.php
<?php function csvtoservice($url,$options){ $csv = get($url); $lines = preg_split('/\r?\n/msi',$csv); $columns = split(',', strtoLower( preg_replace('/\s/','',$lines[0]) ) ); $colstring = join(',',$columns); .......
Can somebody help me to avoid above Tag error?
Thanks in advance
Offline
Re: Tag txp:php
php split() is deprecated in php 5.3 upwards and txp is just notifying you of that. For simple splitting at a character/string, you can use explode in its place, for more complex splitting at a regular expression, use preg_split(). For example:
$columns = explode(',',
strtoLower(
preg_replace('/\s/','',$lines[0])
)
);
You may need to hunt down any other instances in your included script.
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1