Como posso criar um condicional com este tipo de configuração

  • Autor Autor Masterock
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
M

Masterock

Beta
Usuário com poucas negociações! Use sempre o saldo do ForoBeta!
Buenas, hace poco instale el mod-system, y hay que realizar unas modificaciones en los templates, hay una en particular que quisiera cambiar, es la de forumdisplay, en esta para este mod se debe realizar el siguiente cambio

FORUMDISPLAY
search for:

Inserir CODE, HTML ou PHP:
<span class="threadtitle">
 <a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase title}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase thread_starter}{vb:raw sortarrow.postusername}</a> 
</span>


replace with:

Inserir CODE, HTML ou PHP:
<vb:if condition="$show[replace_mod]">
<else />
 <span class="threadtitle">
	<span style="float:{vb:stylevar right}">{vb:rawphrase .modsystem_installs}</span>
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase modsystem_mod}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase modsystem_developer}{vb:raw sortarrow.postusername}</a> 
 </span>
<vb:else />
 <span class="threadtitle">
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase title}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase thread_starter}{vb:raw sortarrow.postusername}</a> 
 </span>
</vb:if>

Esto cambia la vista de ese template para todos los foros sin importar si estos estan seleccionados para que funciono o no el mod.

Ahora, me gustaria hacer un condicional que precisamente haga eso, para los foros del mod system, use la modificacion, pero para los demas foros use el codigo original del template, es decir

Si este foro esta en el modsyste haga
Inserir CODE, HTML ou PHP:
<vb:if condition="$show[replace_mod]">
<else />
 <span class="threadtitle">
	<span style="float:{vb:stylevar right}">{vb:rawphrase .modsystem_installs}</span>
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase modsystem_mod}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase modsystem_developer}{vb:raw sortarrow.postusername}</a> 
 </span>
<vb:else />
 <span class="threadtitle">
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase title}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase thread_starter}{vb:raw sortarrow.postusername}</a> 
 </span>
</vb:if>
de lo contrario haga
Inserir CODE, HTML ou PHP:
<span class="threadtitle">
 <a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase title}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase thread_starter}{vb:raw sortarrow.postusername}</a> 
</span>
fin si

ahora, se que el dato de configuración es:
Inserir CODE, HTML ou PHP:
<setting varname="modsettings_forumids" displayorder="20">
				<datatype>free</datatype>
				<optioncode>multiselect:eval
$options = construct_forum_chooser_options(1);</optioncode>
				<defaultvalue>0</defaultvalue>
			</setting>

y tambien se que para vb los condicionales se manejan de esta forma:

Inserir CODE, HTML ou PHP:
<vb:if condition="condición">
    [I]Sentencias[/I]....
<vb:else />
   [I] Sentencias....[/I]
</vb:if>

Lo que no se es que condición debo colocar en el condicional, teniendo en cuenta ese tipo de dato que se maneja en la configuración.
Yo me imagino que ese dato bota un array, pero no tengo la menor idea como comparar arrays en vb

Alguien me puede ayudar con eso?

EDIT: Corregido, ya funciona de esa manera el modsystem, pero hay un "else" que esta de más.

En replace with:

Inserir CODE, HTML ou PHP:
<vb:if condition="$show[replace_mod]">
[COLOR="red"][B]<else />[/B][/COLOR]
 <span class="threadtitle">
	<span style="float:{vb:stylevar right}">{vb:rawphrase .modsystem_installs}</span>
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase modsystem_mod}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase modsystem_developer}{vb:raw sortarrow.postusername}</a> 
 </span>
<vb:else />
 <span class="threadtitle">
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_title}}" rel="nofollow">{vb:rawphrase title}{vb:raw sortarrow.title}</a> /
	<a href="{vb:link forum, {vb:raw foruminfo}, {vb:raw pageinfo_postusername}}" rel="nofollow">{vb:rawphrase thread_starter}{vb:raw sortarrow.postusername}</a> 
 </span>
</vb:if>
 
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
Me siento complacido de que lo hayas resuelto 🙂.

Saludos.
 
Voltar
Topo